MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / fetch

Function fetch

web/packages/tca-analysis/src/utils/fetch.ts:26–47  ·  view source on GitHub ↗
(url: string, options: any, absolutePath = false)

Source from the content-addressed store, hash-verified

24}
25
26export default function fetch(url: string, options: any, absolutePath = false) {
27 const contentType = get(options, 'headers.Content-Type');
28
29 let headers: any = {
30 };
31
32 const tk = localStorage.getItem('accessToken');
33 if (tk && tk !== 'undefined') {
34 headers.Authorization = `CodeDog ${tk}`;
35 }
36
37 if (contentType) {
38 headers = {
39 ...headers,
40 'Content-Type': contentType,
41 };
42 }
43
44 options.headers = appendXSRFTokenHeader(headers);
45
46 return window.fetch(`${absolutePath ? '' : window.location.origin}${url}`, options);
47}

Callers 4

requestFunction · 0.50
getFileFunction · 0.50
postFileFunction · 0.50
uploadFunction · 0.50

Calls 2

getFunction · 0.85
appendXSRFTokenHeaderFunction · 0.85

Tested by

no test coverage detected