MCPcopy Index your code
hub / github.com/filebrowser/filebrowser / fetchJSON

Function fetchJSON

frontend/src/api/utils.ts:66–74  ·  view source on GitHub ↗
(url: string, opts?: any)

Source from the content-addressed store, hash-verified

64}
65
66export async function fetchJSON<T>(url: string, opts?: any): Promise<T> {
67 const res = await fetchURL(url, opts);
68
69 if (res.status === 200) {
70 return res.json() as Promise<T>;
71 }
72
73 throw new StatusError(`${res.status} ${res.statusText}`, res.status);
74}
75
76export function removePrefix(url: string): string {
77 url = url.split("/").splice(2).join("/");

Callers 6

getAllFunction · 0.90
getFunction · 0.90
getFunction · 0.90
listFunction · 0.90
getFunction · 0.90
createFunction · 0.90

Calls 1

fetchURLFunction · 0.85

Tested by

no test coverage detected