MCPcopy Index your code
hub / github.com/GitbookIO/gitbook / fetchURL

Function fetchURL

packages/openapi-parser/src/scalar-plugins/fetchURL.ts:8–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6};
7
8export const fetchURL = (): Plugin => ({
9 type: 'loader',
10 validate(value) {
11 return URL.canParse(value);
12 },
13 async exec(value) {
14 try {
15 const response = await fetch(value);
16 if (!response.ok) {
17 return { ok: false };
18 }
19 const text = await response.text();
20 return {
21 ok: true,
22 data: normalize(text),
23 };
24 } catch {
25 return { ok: false };
26 }
27 },
28});

Callers 1

createFileSystemFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected