(
context: ExecutionContext,
defaultOptions: HttpInstrumentationOptions = {},
)
| 116 | } |
| 117 | |
| 118 | export function createHttpClient( |
| 119 | context: ExecutionContext, |
| 120 | defaultOptions: HttpInstrumentationOptions = {}, |
| 121 | ): { |
| 122 | fetch: ( |
| 123 | input: HttpRequestInput, |
| 124 | init?: RequestInit, |
| 125 | options?: HttpInstrumentationOptions, |
| 126 | ) => Promise<Response>; |
| 127 | toCurl: (input: HttpRequestInput, init?: RequestInit) => string; |
| 128 | } { |
| 129 | return { |
| 130 | fetch: (input, init, options) => |
| 131 | instrumentedFetch( |
| 132 | input, |
| 133 | init, |
| 134 | context, |
| 135 | { ...defaultOptions, ...options }, |
| 136 | ), |
| 137 | toCurl: (input, init) => |
| 138 | harToCurl( |
| 139 | buildHarRequest( |
| 140 | input instanceof URL ? input.toString() : input, |
| 141 | init, |
| 142 | resolveOptions(defaultOptions), |
| 143 | ), |
| 144 | ), |
| 145 | }; |
| 146 | } |
no test coverage detected