MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / fetchGitLab

Function fetchGitLab

apps/web/src/lib/integrations/platforms/gitlab/adapter.ts:35–56  ·  view source on GitHub ↗
(url: string, init?: RequestInit, redirectCount = 0)

Source from the content-addressed store, hash-verified

33const GITLAB_REQUEST_TIMEOUT_MS = 30_000;
34
35async function fetchGitLab(url: string, init?: RequestInit, redirectCount = 0): Promise<Response> {
36 const response = await fetchGitLabOnce(url, init);
37 if (!isGitLabRedirect(response.status)) {
38 return response;
39 }
40
41 const location = response.headers.get('location');
42 if (!location) {
43 return response;
44 }
45
46 if (redirectCount >= MAX_GITLAB_REDIRECTS) {
47 throw new Error('GitLab request exceeded redirect limit');
48 }
49
50 const redirectUrl = new URL(location, url).toString();
51 return fetchGitLab(
52 redirectUrl,
53 buildRedirectRequestInit(init, response.status, url, redirectUrl),
54 redirectCount + 1
55 );
56}
57
58async function fetchGitLabOnce(url: string, init?: RequestInit): Promise<Response> {
59 const resolvedUrl = await resolveGitLabUrlSafely(url);

Callers 15

exchangeGitLabOAuthCodeFunction · 0.85
refreshGitLabOAuthTokenFunction · 0.85
fetchGitLabUserFunction · 0.85
fetchGitLabProjectsFunction · 0.85
fetchGitLabBranchesFunction · 0.85
listProjectWebhooksFunction · 0.85
createProjectWebhookFunction · 0.85
updateProjectWebhookFunction · 0.85
deleteProjectWebhookFunction · 0.85
isMergeCommitFunction · 0.85
fetchGitLabMergeRequestFunction · 0.85

Calls 5

fetchGitLabOnceFunction · 0.85
isGitLabRedirectFunction · 0.85
buildRedirectRequestInitFunction · 0.85
getMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected