您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

41 行
1.4 KiB

  1. /*
  2. Copyright 2018 Google Inc. All Rights Reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. import '../_version.mjs';
  14. /**
  15. * This is a utility method that determines whether the current browser supports
  16. * the features required to create streamed responses. Currently, it checks if
  17. * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
  18. * is available.
  19. *
  20. * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
  21. * `'text/html'` will be used by default.
  22. * @return {boolean} `true`, if the current browser meets the requirements for
  23. * streaming responses, and `false` otherwise.
  24. *
  25. * @memberof workbox.streams
  26. */
  27. function createHeaders(headersInit = {}) {
  28. // See https://github.com/GoogleChrome/workbox/issues/1461
  29. const headers = new Headers(headersInit);
  30. if (!headers.has('content-type')) {
  31. headers.set('content-type', 'text/html');
  32. }
  33. return headers;
  34. }
  35. export {createHeaders};