summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/test-request-headers-worker.js
blob: 566e2e9984b5d6b5d3a79738542f1b2b24d1f6b2 (plain)
1
2
3
4
5
6
7
8
9
10
// Add a unique UUID per request to induce service worker script update.
// Time stamp: %UUID%

// The server injects the request headers here as a JSON string.
const headersAsJson = `%HEADERS%`;
const headers = JSON.parse(headersAsJson);

self.addEventListener('message', async (e) => {
  e.source.postMessage(headers);
});