MCPcopy Create free account
hub / github.com/ShipSecAI/studio / createHttpClient

Function createHttpClient

packages/component-sdk/src/http/instrumented-fetch.ts:118–146  ·  view source on GitHub ↗
(
  context: ExecutionContext,
  defaultOptions: HttpInstrumentationOptions = {},
)

Source from the content-addressed store, hash-verified

116}
117
118export 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}

Callers 1

createExecutionContextFunction · 0.90

Calls 4

harToCurlFunction · 0.90
buildHarRequestFunction · 0.90
instrumentedFetchFunction · 0.85
resolveOptionsFunction · 0.85

Tested by

no test coverage detected