MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / fetchApi

Function fetchApi

web/src/js/utils.ts:86–102  ·  view source on GitHub ↗
(
    url: string,
    options: RequestInit = {},
)

Source from the content-addressed store, hash-verified

84};
85
86export function fetchApi(
87 url: string,
88 options: RequestInit = {},
89): Promise<Response> {
90 if (options.method && options.method !== "GET") {
91 options.headers = options.headers || {};
92 options.headers["X-XSRFToken"] = xsrf();
93 }
94 if (url.startsWith("/")) {
95 url = "." + url;
96 }
97
98 return fetch(url, {
99 credentials: "same-origin",
100 ...options,
101 });
102}
103
104fetchApi.put = (url: string, json: any, options: RequestInit = {}) =>
105 fetchApi(url, {

Callers 15

CommandBarFunction · 0.90
handleClickCopyButtonFunction · 0.90
useContentFunction · 0.90
componentDidMountMethod · 0.90
fetchDataMethod · 0.90
fetchDataMethod · 0.90
processes.tsFile · 0.90
saveFunction · 0.90
resumeFunction · 0.90
resumeAllFunction · 0.90
killFunction · 0.90
killAllFunction · 0.90

Calls 1

xsrfFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…