(endpoint, localPort)
| 136 | } |
| 137 | |
| 138 | async 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 | |
| 151 | function writeSpec(path, spec) { |
| 152 | sanitizeSelfReferentialUnions(spec); |
no test coverage detected