( input: RequestInfo, init?: RequestInit )
| 81 | * that does not list `127.0.0.1`/`localhost` in `no_proxy`. |
| 82 | */ |
| 83 | export function directFetch( |
| 84 | input: RequestInfo, |
| 85 | init?: RequestInit |
| 86 | ): Promise<Response> { |
| 87 | const options = { ...init } as RequestInit & { |
| 88 | dispatcher?: FetchDispatcher; |
| 89 | duplex?: 'half'; |
| 90 | }; |
| 91 | |
| 92 | // Ensure no dispatcher (proxy or otherwise) is applied. |
| 93 | delete options.dispatcher; |
| 94 | |
| 95 | if (init?.body instanceof Readable) { |
| 96 | options.duplex = 'half'; |
| 97 | } |
| 98 | |
| 99 | return globalThis.fetch( |
| 100 | input, |
| 101 | options as unknown as NativeRequestInit |
| 102 | ) as Promise<Response>; |
| 103 | } |
| 104 | |
| 105 | export function toNodeReadable(body: Response['body']): Readable { |
| 106 | if (!body) { |
no test coverage detected