(req: OriginValidationRequest)
| 230 | } |
| 231 | |
| 232 | function inferProtocol(req: OriginValidationRequest): "http" | "https" { |
| 233 | if (typeof req.protocol === "string") { |
| 234 | const normalized = normalizeProtocol(req.protocol); |
| 235 | if (normalized) { |
| 236 | return normalized; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | return (req.socket as { encrypted?: boolean }).encrypted ? "https" : "http"; |
| 241 | } |
| 242 | |
| 243 | function getExpectedHosts(req: OriginValidationRequest): string[] { |
| 244 | return [getFirstHeaderValue(req, "x-forwarded-host"), getFirstHeaderValue(req, "host")].filter( |
no test coverage detected