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

Function request

frontend/openAPI/generated/core/request.ts:293–322  ·  view source on GitHub ↗
(config: OpenAPIConfig, options: ApiRequestOptions)

Source from the content-addressed store, hash-verified

291 * @throws ApiError
292 */
293export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise<T> => {
294 return new CancelablePromise(async (resolve, reject, onCancel) => {
295 try {
296 const url = getUrl(config, options);
297 const formData = getFormData(options);
298 const body = getRequestBody(options);
299 const headers = await getHeaders(config, options);
300
301 if (!onCancel.isCancelled) {
302 const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
303 const responseBody = await getResponseBody(response);
304 const responseHeader = getResponseHeader(response, options.responseHeader);
305
306 const result: ApiResult = {
307 url,
308 ok: response.ok,
309 status: response.status,
310 statusText: response.statusText,
311 body: responseHeader ?? responseBody,
312 };
313
314 catchErrorCodes(options, result);
315
316 resolve(result.body);
317 }
318 } catch (error) {
319 reject(error);
320 }
321 });
322};

Callers

nothing calls this directly

Calls 9

getUrlFunction · 0.85
getFormDataFunction · 0.85
getRequestBodyFunction · 0.85
getHeadersFunction · 0.85
sendRequestFunction · 0.85
getResponseBodyFunction · 0.85
getResponseHeaderFunction · 0.85
catchErrorCodesFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected