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