({ status = 403, html = '<html><body>403 Forbidden (WAF)</body></html>' } = {})
| 45 | // has no `json()` body the API path can parse. readHubResponseText falls back |
| 46 | // to `res.text()` here since there is no streaming body.getReader. |
| 47 | function responseFromHtml({ status = 403, html = '<html><body>403 Forbidden (WAF)</body></html>' } = {}) { |
| 48 | return { |
| 49 | ok: status >= 200 && status < 300, |
| 50 | status, |
| 51 | headers: { get: (k) => (k.toLowerCase() === 'content-type' ? 'text/html; charset=utf-8' : null) }, |
| 52 | text: async () => html, |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | function responseFromJson({ status = 200, json = {}, headers = {} } = {}) { |
| 57 | const merged = { 'content-type': 'application/json', ...headers }; |
no outgoing calls
no test coverage detected