MCPcopy Create free account
hub / github.com/SecureAI-Tools/SecureAI-Tools / makeRequest

Function makeRequest

apps/web/lib/fe/api.ts:67–88  ·  view source on GitHub ↗
(
  method: HttpMethod,
  input: RequestInfo,
  req: REQ | null,
  init?: RequestInit,
)

Source from the content-addressed store, hash-verified

65}
66
67async function makeRequest<REQ, RES>(
68 method: HttpMethod,
69 input: RequestInfo,
70 req: REQ | null,
71 init?: RequestInit,
72): Promise<ResponseWithHeaders<RES>> {
73 const res = await fetchHelper(method, input, req, init);
74
75 if (!res.ok) {
76 throw new FetchError(
77 "An error occurred while fetching the data.",
78 res.status,
79 await res.json(),
80 );
81 }
82
83 const parsedResponse = await res.json();
84 return {
85 response: parsedResponse as RES,
86 headers: parseResponseHeaders(res),
87 };
88}
89
90async function makeRequestStreaming<REQ>({
91 method,

Callers 1

createFetcherFunction · 0.85

Calls 2

fetchHelperFunction · 0.85
parseResponseHeadersFunction · 0.85

Tested by

no test coverage detected