( req: OriginValidationRequest, allowHttpOrigin = false )
| 304 | } |
| 305 | |
| 306 | function getPreferredPublicProtocol( |
| 307 | req: OriginValidationRequest, |
| 308 | allowHttpOrigin = false |
| 309 | ): "http" | "https" { |
| 310 | const clientFacingProtocol = getClientFacingProtocol(req); |
| 311 | const originProtocol = getOriginProtocolOnExpectedHost(req); |
| 312 | |
| 313 | if (allowHttpOrigin && clientFacingProtocol === "http" && originProtocol === "https") { |
| 314 | return "https"; |
| 315 | } |
| 316 | |
| 317 | return clientFacingProtocol; |
| 318 | } |
| 319 | |
| 320 | function getExpectedOrigins(req: OriginValidationRequest, allowHttpOrigin = false): string[] { |
| 321 | const hosts = getExpectedHosts(req); |
no test coverage detected