MCPcopy
hub / github.com/iterative/cml / request

Method request

src/drivers/gitlab.js:563–589  ·  view source on GitHub ↗
(opts = {})

Source from the content-addressed store, hash-verified

561 }
562
563 async request(opts = {}) {
564 const { token } = this;
565 const { endpoint, method = 'GET', body, raw } = opts;
566 let { url } = opts;
567
568 if (endpoint) {
569 url = `${await this.repoBase()}/api/${API_VER}${endpoint}`;
570 }
571 if (!url) throw new Error('Gitlab API endpoint not found');
572
573 logger.debug(`Gitlab API request, method: ${method}, url: "${url}"`);
574
575 const headers = { 'PRIVATE-TOKEN': token, Accept: 'application/json' };
576 const response = await fetch(url, {
577 method,
578 headers,
579 body,
580 agent: new ProxyAgent()
581 });
582 if (!response.ok) {
583 logger.debug(`Response status is ${response.status}`);
584 throw new Error(response.statusText);
585 }
586 if (raw) return response;
587
588 return await response.json();
589 }
590
591 warn(message) {
592 logger.warn(message);

Callers 15

repoBaseMethod · 0.95
commitCommentCreateMethod · 0.95
commitCommentsMethod · 0.95
commitPrsMethod · 0.95
uploadMethod · 0.95
runnerTokenMethod · 0.95
registerRunnerMethod · 0.95
unregisterRunnerMethod · 0.95
runnersMethod · 0.95
runnerByIdMethod · 0.95
prCreateMethod · 0.95
prAutoMergeMethod · 0.95

Calls 1

repoBaseMethod · 0.95

Tested by

no test coverage detected