(statusCode, method)
| 26 | } |
| 27 | |
| 28 | function shouldRewriteMethodForRedirect(statusCode, method) { |
| 29 | const normalizedMethod = normalizeMethod(method); |
| 30 | if (normalizedMethod === "HEAD") return false; |
| 31 | |
| 32 | if (statusCode === 303) return true; |
| 33 | if ((statusCode === 301 || statusCode === 302) && normalizedMethod === "POST") { |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | function normalizeHostname(hostname) { |
| 41 | return String(hostname || "") |
no test coverage detected