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

Method request

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

Source from the content-addressed store, hash-verified

216 }
217
218 async request(
219 path: string,
220 options: Options = {},
221 parser = (response: Response) => this.parseResponse(response),
222 ) {
223 options = { cache: 'no-cache', ...options };
224 const headers = await this.requestHeaders(options.headers || {});
225 const url = this.urlFor(path, options);
226 let responseStatus = 500;
227
228 try {
229 const req = unsentRequest.fromFetchArguments(url, {
230 ...options,
231 headers,
232 }) as unknown as ApiRequest;
233 const response = await requestWithBackoff(this, req);
234 responseStatus = response.status;
235 const parsedResponse = await parser(response);
236 return parsedResponse;
237 // eslint-disable-next-line @typescript-eslint/no-explicit-any
238 } catch (error: any) {
239 return this.handleRequestError(error, responseStatus);
240 }
241 }
242
243 nextUrlProcessor() {
244 return (url: string) => url;

Callers 15

APIClass · 0.95
fetchContentMethod · 0.95
getUserMethod · 0.95
hasWriteAccessMethod · 0.95
fetchFileMetadataMethod · 0.95
fetchBlobContentMethod · 0.95
listFilesMethod · 0.95
changeFilesMethod · 0.95
getFileShaMethod · 0.95
APIClass · 0.95
fetchContentMethod · 0.95
getFileIdMethod · 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