|
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
|
| Rev | Line | |
|---|
| [9af201e] | 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 | */
|
|---|
| 8 |
|
|---|
| 9 | import '../_version.js';
|
|---|
| 10 |
|
|---|
| 11 | /**
|
|---|
| 12 | * This is a utility method that determines whether the current browser supports
|
|---|
| 13 | * the features required to create streamed responses. Currently, it checks if
|
|---|
| 14 | * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
|
|---|
| 15 | * is available.
|
|---|
| 16 | *
|
|---|
| 17 | * @private
|
|---|
| 18 | * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
|
|---|
| 19 | * `'text/html'` will be used by default.
|
|---|
| 20 | * @return {boolean} `true`, if the current browser meets the requirements for
|
|---|
| 21 | * streaming responses, and `false` otherwise.
|
|---|
| 22 | *
|
|---|
| 23 | * @memberof workbox-streams
|
|---|
| 24 | */
|
|---|
| 25 | function createHeaders(headersInit = {}): Headers {
|
|---|
| 26 | // See https://github.com/GoogleChrome/workbox/issues/1461
|
|---|
| 27 | const headers = new Headers(headersInit);
|
|---|
| 28 | if (!headers.has('content-type')) {
|
|---|
| 29 | headers.set('content-type', 'text/html');
|
|---|
| 30 | }
|
|---|
| 31 | return headers;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | export {createHeaders};
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.