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

Method request

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

Source from the content-addressed store, hash-verified

242 }
243
244 async request(
245 path: string,
246 options: Options = {},
247 parser = (response: Response) => this.parseResponse(response),
248 ) {
249 options = { cache: 'no-cache', ...options };
250 const headers = await this.requestHeaders(options.headers || {});
251 const url = this.urlFor(path, options);
252 let responseStatus = 500;
253
254 try {
255 const req = unsentRequest.fromFetchArguments(url, {
256 ...options,
257 headers,
258 }) as unknown as ApiRequest;
259 const response = await requestWithBackoff(this, req);
260 responseStatus = response.status;
261 const parsedResponse = await parser(response);
262 return parsedResponse;
263 // eslint-disable-next-line @typescript-eslint/no-explicit-any
264 } catch (error: any) {
265 return this.handleRequestError(error, responseStatus);
266 }
267 }
268
269 nextUrlProcessor() {
270 return (url: string) => url;

Callers 15

getUserMethod · 0.95
hasWriteAccessMethod · 0.95
fetchFileMetadataMethod · 0.95
fetchBlobContentMethod · 0.95
listFilesMethod · 0.95
changeFilesMethod · 0.95
getFileShaMethod · 0.95
getBranchMethod · 0.95
createBranchMethod · 0.95
deleteBranchMethod · 0.95
createPRMethod · 0.95
updatePRMethod · 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