MCPcopy Index your code
hub / github.com/utterance/utterances / githubFetch

Function githubFetch

src/github.ts:84–108  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

82}
83
84function githubFetch(request: Request): Promise<Response> {
85 return fetch(request).then(response => {
86 if (response.status === 401) {
87 token.value = null;
88 }
89 if (response.status === 403) {
90 response.json().then(data => {
91 if (data.message === 'Resource not accessible by integration') {
92 window.dispatchEvent(new CustomEvent('not-installed'));
93 }
94 });
95 }
96
97 processRateLimit(response);
98
99 if (request.method === 'GET'
100 && [401, 403].indexOf(response.status) !== -1
101 && request.headers.has('Authorization')
102 ) {
103 request.headers.delete('Authorization');
104 return githubFetch(request);
105 }
106 return response;
107 });
108}
109
110export function loadJsonFile<T>(path: string, html = false) {
111 const request = githubRequest(`repos/${owner}/${repo}/contents/${path}?ref=${branch}`);

Callers 8

loadJsonFileFunction · 0.85
loadIssueByTermFunction · 0.85
loadIssueByNumberFunction · 0.85
loadCommentsPageFunction · 0.85
loadUserFunction · 0.85
postCommentFunction · 0.85
toggleReactionFunction · 0.85
renderMarkdownFunction · 0.85

Calls 1

processRateLimitFunction · 0.85

Tested by

no test coverage detected