(dispatcher: Undici.Dispatcher)
| 41 | |
| 42 | /** @internal */ |
| 43 | export const make = (dispatcher: Undici.Dispatcher): Client.HttpClient => |
| 44 | Client.make((request, url, signal, fiber) => { |
| 45 | const context = fiber.getFiberRef(FiberRef.currentContext) |
| 46 | const options: Undici.Dispatcher.RequestOptions = context.unsafeMap.get(undiciOptionsTagKey) ?? {} |
| 47 | return convertBody(request.body).pipe( |
| 48 | Effect.flatMap((body) => |
| 49 | Effect.tryPromise({ |
| 50 | try: () => |
| 51 | dispatcher.request({ |
| 52 | ...options, |
| 53 | signal, |
| 54 | method: request.method, |
| 55 | headers: request.headers, |
| 56 | origin: url.origin, |
| 57 | path: url.pathname + url.search + url.hash, |
| 58 | body, |
| 59 | // leave timeouts to Effect.timeout etc |
| 60 | headersTimeout: 60 * 60 * 1000, |
| 61 | bodyTimeout: 0 |
| 62 | }), |
| 63 | catch: (cause) => |
| 64 | new Error.RequestError({ |
| 65 | request, |
| 66 | reason: "Transport", |
| 67 | cause |
| 68 | }) |
| 69 | }) |
| 70 | ), |
| 71 | Effect.map((response) => new ClientResponseImpl(request, response)) |
| 72 | ) |
| 73 | }) |
| 74 | |
| 75 | function convertBody( |
| 76 | body: Body.HttpBody |
nothing calls this directly
no test coverage detected
searching dependent graphs…