(source: Http.IncomingMessage)
| 609 | // HTTP/2 sends the authority as `:authority`, which takes precedence over a Host header. |
| 610 | // Pseudo-headers are not valid header names elsewhere, such as in a web `Request`. |
| 611 | const requestHeaders = (source: Http.IncomingMessage): Http.IncomingHttpHeaders => { |
| 612 | if (!isHttp2(source)) { |
| 613 | return source.headers |
| 614 | } |
| 615 | const headers: Http.IncomingHttpHeaders = {} |
| 616 | for (const name in source.headers) { |
| 617 | if (name[0] !== ":") headers[name] = source.headers[name] |
| 618 | } |
| 619 | const authority = source.headers[":authority"] |
| 620 | if (typeof authority === "string") headers.host = authority |
| 621 | return headers |
| 622 | } |
| 623 | |
| 624 | const absoluteTarget = (url: string): URL | undefined => { |
| 625 | if (!/^https?:\/\//i.test(url)) { |
no test coverage detected