(request3)
| 6879 | signal: { enumerable: true } |
| 6880 | }); |
| 6881 | function getNodeRequestOptions(request3) { |
| 6882 | const parsedURL = request3[INTERNALS$2].parsedURL; |
| 6883 | const headers = new Headers6(request3[INTERNALS$2].headers); |
| 6884 | if (!headers.has("Accept")) { |
| 6885 | headers.set("Accept", "*/*"); |
| 6886 | } |
| 6887 | if (!parsedURL.protocol || !parsedURL.hostname) { |
| 6888 | throw new TypeError("Only absolute URLs are supported"); |
| 6889 | } |
| 6890 | if (!/^https?:$/.test(parsedURL.protocol)) { |
| 6891 | throw new TypeError("Only HTTP(S) protocols are supported"); |
| 6892 | } |
| 6893 | if (request3.signal && request3.body instanceof Stream3.Readable && !streamDestructionSupported) { |
| 6894 | throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8"); |
| 6895 | } |
| 6896 | let contentLengthValue = null; |
| 6897 | if (request3.body == null && /^(POST|PUT)$/i.test(request3.method)) { |
| 6898 | contentLengthValue = "0"; |
| 6899 | } |
| 6900 | if (request3.body != null) { |
| 6901 | const totalBytes = getTotalBytes(request3); |
| 6902 | if (typeof totalBytes === "number") { |
| 6903 | contentLengthValue = String(totalBytes); |
| 6904 | } |
| 6905 | } |
| 6906 | if (contentLengthValue) { |
| 6907 | headers.set("Content-Length", contentLengthValue); |
| 6908 | } |
| 6909 | if (!headers.has("User-Agent")) { |
| 6910 | headers.set("User-Agent", "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"); |
| 6911 | } |
| 6912 | if (request3.compress && !headers.has("Accept-Encoding")) { |
| 6913 | headers.set("Accept-Encoding", "gzip,deflate"); |
| 6914 | } |
| 6915 | let agent = request3.agent; |
| 6916 | if (typeof agent === "function") { |
| 6917 | agent = agent(parsedURL); |
| 6918 | } |
| 6919 | return Object.assign({}, parsedURL, { |
| 6920 | method: request3.method, |
| 6921 | headers: exportNodeCompatibleHeaders(headers), |
| 6922 | agent |
| 6923 | }); |
| 6924 | } |
| 6925 | function AbortError2(message) { |
| 6926 | Error.call(this, message); |
| 6927 | this.type = "aborted"; |
no test coverage detected
searching dependent graphs…