MCPcopy Create free account
hub / github.com/F12FLASH/CTF / apiRequest

Function apiRequest

7.GraphQL Apocalypse/client/src/lib/queryClient.ts:10–24  ·  view source on GitHub ↗
(
  method: string,
  url: string,
  data?: unknown | undefined,
)

Source from the content-addressed store, hash-verified

8}
9
10export async function apiRequest(
11 method: string,
12 url: string,
13 data?: unknown | undefined,
14): Promise<Response> {
15 const res = await fetch(url, {
16 method,
17 headers: data ? { "Content-Type": "application/json" } : {},
18 body: data ? JSON.stringify(data) : undefined,
19 credentials: "include",
20 });
21
22 await throwIfResNotOk(res);
23 return res;
24}
25
26type UnauthorizedBehavior = "returnNull" | "throw";
27export const getQueryFn: <T>(options: {

Callers 2

FlagModalFunction · 0.90
QueryEditorFunction · 0.90

Calls 1

throwIfResNotOkFunction · 0.70

Tested by

no test coverage detected