fetch-event-respond-with-response-body-with-invalid-chunk-worker.js (444B)
1 'use strict'; 2 3 self.addEventListener('fetch', event => { 4 if (!event.request.url.match(/body-stream-with-invalid-chunk$/)) 5 return; 6 const stream = new ReadableStream({start: controller => { 7 // The argument is intentionally a string, not a Uint8Array. 8 controller.enqueue('hello'); 9 }}); 10 const headers = { 'x-content-type-options': 'nosniff' }; 11 event.respondWith(new Response(stream, { headers })); 12 });