MCPcopy Create free account
hub / github.com/FxEmbed/FxEmbed / fetchSpec

Function fetchSpec

docs/scripts/extract-openapi.mjs:138–149  ·  view source on GitHub ↗
(endpoint, localPort)

Source from the content-addressed store, hash-verified

136}
137
138async function fetchSpec(endpoint, localPort) {
139 if (localPort) {
140 return fetchLocalOpenApi(localPort, endpoint.localHostHeader);
141 }
142 const res = await fetch(endpoint.url, {
143 headers: { 'User-Agent': 'FxEmbed-Docs-Builder/1.0' }
144 });
145 if (!res.ok) {
146 throw new Error(`${endpoint.url}: HTTP ${res.status}`);
147 }
148 return res.json();
149}
150
151function writeSpec(path, spec) {
152 sanitizeSelfReferentialUnions(spec);

Callers 1

mainFunction · 0.85

Calls 2

fetchLocalOpenApiFunction · 0.85
fetchFunction · 0.85

Tested by

no test coverage detected