(response: HttpClientResponse.HttpClientResponse, contentType: string | undefined)
| 53 | } |
| 54 | |
| 55 | const captureResponseBody = (response: HttpClientResponse.HttpClientResponse, contentType: string | undefined) => |
| 56 | response.arrayBuffer.pipe( |
| 57 | Effect.map((bytes) => |
| 58 | isTextContentType(contentType) |
| 59 | ? { body: new TextDecoder().decode(bytes) } |
| 60 | : { body: Buffer.from(bytes).toString("base64"), bodyEncoding: "base64" as const }, |
| 61 | ), |
| 62 | ) |
| 63 | |
| 64 | const decodeResponseBody = (snapshot: ResponseSnapshot) => |
| 65 | snapshot.bodyEncoding === "base64" ? Buffer.from(snapshot.body, "base64") : snapshot.body |
no test coverage detected