MCPcopy Create free account
hub / github.com/ShaanCoding/makeread.me / sendRequest

Function sendRequest

frontend/openAPI/generated/core/request.ts:195–220  ·  view source on GitHub ↗
(
    config: OpenAPIConfig,
    options: ApiRequestOptions,
    url: string,
    body: any,
    formData: FormData | undefined,
    headers: Headers,
    onCancel: OnCancel
)

Source from the content-addressed store, hash-verified

193};
194
195export const sendRequest = async (
196 config: OpenAPIConfig,
197 options: ApiRequestOptions,
198 url: string,
199 body: any,
200 formData: FormData | undefined,
201 headers: Headers,
202 onCancel: OnCancel
203): Promise<Response> => {
204 const controller = new AbortController();
205
206 const request: RequestInit = {
207 headers,
208 body: body ?? formData,
209 method: options.method,
210 signal: controller.signal,
211 };
212
213 if (config.WITH_CREDENTIALS) {
214 request.credentials = config.CREDENTIALS;
215 }
216
217 onCancel(() => controller.abort());
218
219 return await fetch(url, request);
220};
221
222export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
223 if (responseHeader) {

Callers 1

requestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected