source: frontend/node_modules/workbox-streams/utils/createHeaders.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 Copyright 2018 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8import '../_version.js';
9/**
10 * This is a utility method that determines whether the current browser supports
11 * the features required to create streamed responses. Currently, it checks if
12 * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
13 * is available.
14 *
15 * @private
16 * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
17 * `'text/html'` will be used by default.
18 * @return {boolean} `true`, if the current browser meets the requirements for
19 * streaming responses, and `false` otherwise.
20 *
21 * @memberof workbox-streams
22 */
23function createHeaders(headersInit = {}) {
24 // See https://github.com/GoogleChrome/workbox/issues/1461
25 const headers = new Headers(headersInit);
26 if (!headers.has('content-type')) {
27 headers.set('content-type', 'text/html');
28 }
29 return headers;
30}
31export { createHeaders };
Note: See TracBrowser for help on using the repository browser.