| 1061 | } |
| 1062 | |
| 1063 | class FiniteChunkFetchFactory extends FetchFactory { |
| 1064 | override fetch = async (_input: RequestInfo | URL, _init?: RequestInit): Promise<Response> => { |
| 1065 | const stream = new ReadableStream<Uint8Array>({ |
| 1066 | start: (controller) => { |
| 1067 | controller.enqueue(new TextEncoder().encode('ok')); |
| 1068 | controller.close(); |
| 1069 | }, |
| 1070 | }); |
| 1071 | |
| 1072 | return new Response(stream, { |
| 1073 | status: HttpStatusCode.Ok, |
| 1074 | statusText: 'OK', |
| 1075 | headers: {'Content-Type': 'text/plain', 'Content-Length': '2'}, |
| 1076 | }); |
| 1077 | }; |
| 1078 | } |
| 1079 | |
| 1080 | class MockFetchResponse { |
| 1081 | public url?: string; |