(status, headersList, resume2, statusText)
| 60696 | const { connection } = fetchParams.controller; |
| 60697 | if (connection.destroyed) { |
| 60698 | abort(new DOMException3("The operation was aborted.", "AbortError")); |
| 60699 | } else { |
| 60700 | fetchParams.controller.on("terminated", abort); |
| 60701 | this.abort = connection.abort = abort; |
| 60702 | } |
| 60703 | }, |
| 60704 | onHeaders(status, headersList, resume2, statusText) { |
| 60705 | if (status < 200) { |
| 60706 | return; |
| 60707 | } |
| 60708 | let codings = []; |
| 60709 | let location = ""; |
| 60710 | const headers = new Headers6(); |
| 60711 | if (Array.isArray(headersList)) { |
| 60712 | for (let n2 = 0; n2 < headersList.length; n2 += 2) { |
| 60713 | const key = headersList[n2 + 0].toString("latin1"); |
| 60714 | const val = headersList[n2 + 1].toString("latin1"); |
| 60715 | if (key.toLowerCase() === "content-encoding") { |
| 60716 | codings = val.toLowerCase().split(",").map((x5) => x5.trim()); |
| 60717 | } else if (key.toLowerCase() === "location") { |
| 60718 | location = val; |
| 60719 | } |
| 60720 | headers[kHeadersList].append(key, val); |
| 60721 | } |
| 60722 | } else { |
| 60723 | const keys = Object.keys(headersList); |
| 60724 | for (const key of keys) { |
| 60725 | const val = headersList[key]; |
| 60726 | if (key.toLowerCase() === "content-encoding") { |
| 60727 | codings = val.toLowerCase().split(",").map((x5) => x5.trim()).reverse(); |
| 60728 | } else if (key.toLowerCase() === "location") { |
| 60729 | location = val; |
| 60730 | } |
| 60731 | headers[kHeadersList].append(key, val); |
| 60732 | } |
| 60733 | } |
| 60734 | this.body = new Readable5({ read: resume2 }); |
| 60735 | const decoders = []; |
| 60736 | const willFollow = request3.redirect === "follow" && location && redirectStatusSet.has(status); |
| 60737 | if (request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { |
| 60738 | for (const coding of codings) { |
| 60739 | if (coding === "x-gzip" || coding === "gzip") { |
| 60740 | decoders.push(zlib3.createGunzip({ |
| 60741 | // Be less strict when decoding compressed responses, since sometimes |
| 60742 | // servers send slightly invalid responses that are still accepted |
| 60743 | // by common browsers. |
| 60744 | // Always using Z_SYNC_FLUSH is what cURL does. |
| 60745 | flush: zlib3.constants.Z_SYNC_FLUSH, |
| 60746 | finishFlush: zlib3.constants.Z_SYNC_FLUSH |
| 60747 | })); |
| 60748 | } else if (coding === "deflate") { |
| 60749 | decoders.push(zlib3.createInflate()); |
| 60750 | } else if (coding === "br") { |
| 60751 | decoders.push(zlib3.createBrotliDecompress()); |
| 60752 | } else { |
| 60753 | decoders.length = 0; |
| 60754 | break; |
| 60755 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…