MCPcopy Create free account
hub / github.com/decaporg/decap-cms / request

Method request

packages/decap-cms-backend-github/src/API.ts:369–391  ·  view source on GitHub ↗
(
    path: string,
    options: Options = {},
    parser = (response: Response) => this.parseResponse(response),
  )

Source from the content-addressed store, hash-verified

367 }
368
369 async request(
370 path: string,
371 options: Options = {},
372 parser = (response: Response) => this.parseResponse(response),
373 ) {
374 options = { cache: 'no-cache', ...options };
375 const headers = await this.requestHeaders(options.headers || {});
376 const url = this.urlFor(path, options);
377 let responseStatus = 500;
378
379 try {
380 const req = unsentRequest.fromFetchArguments(url, {
381 ...options,
382 headers,
383 }) as unknown as ApiRequest;
384 const response = await requestWithBackoff(this, req);
385 responseStatus = response.status;
386 const parsedResponse = await parser(response);
387 return parsedResponse;
388 } catch (error) {
389 return this.handleRequestError(error, responseStatus);
390 }
391 }
392
393 nextUrlProcessor() {
394 return (url: string) => url;

Callers 15

hasWriteAccessMethod · 0.95
checkMetadataRefMethod · 0.95
retrieveMetadataOldMethod · 0.95
getPullRequestCommitsMethod · 0.95
getPullRequestAuthorMethod · 0.95
fetchFileMetadataMethod · 0.95
fetchBlobContentMethod · 0.95
listFilesMethod · 0.95
getStatusesMethod · 0.95
getFileShaMethod · 0.95
getDifferencesMethod · 0.95

Calls 5

parseResponseMethod · 0.95
requestHeadersMethod · 0.95
urlForMethod · 0.95
handleRequestErrorMethod · 0.95
requestWithBackoffFunction · 0.90

Tested by

no test coverage detected