summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/fetch-event-respond-with-response-body-with-invalid-chunk-worker.js
blob: 0254e24f94a2ef5210767af5d717e8866e09db0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
'use strict';

self.addEventListener('fetch', event => {
    if (!event.request.url.match(/body-stream-with-invalid-chunk$/))
      return;
    const stream = new ReadableStream({start: controller => {
        // The argument is intentionally a string, not a Uint8Array.
        controller.enqueue('hello');
      }});
    const headers = { 'x-content-type-options': 'nosniff' };
    event.respondWith(new Response(stream, { headers }));
  });