| 894 | } |
| 895 | |
| 896 | class FiniteChunkFetchFactory extends FetchFactory { |
| 897 | override fetch = async (_input: RequestInfo | URL, _init?: RequestInit): Promise<Response> => { |
| 898 | const stream = new ReadableStream<Uint8Array>({ |
| 899 | start: (controller) => { |
| 900 | controller.enqueue(new TextEncoder().encode('ok')); |
| 901 | controller.close(); |
| 902 | }, |
| 903 | }); |
| 904 | |
| 905 | return new Response(stream, { |
| 906 | status: HttpStatusCode.Ok, |
| 907 | statusText: 'OK', |
| 908 | headers: {'Content-Type': 'text/plain', 'Content-Length': '2'}, |
| 909 | }); |
| 910 | }; |
| 911 | } |
| 912 | |
| 913 | class MockFetchResponse { |
| 914 | public url?: string; |