(
req: FastifyRequest,
reply: FastifyReply,
)
| 161 | export function createHostCheck(opts: HostCheckOptions): HostCheck { |
| 162 | const isAllowed = (host: string | undefined): boolean => isAllowedHost(host, opts); |
| 163 | const onRequest = async ( |
| 164 | req: FastifyRequest, |
| 165 | reply: FastifyReply, |
| 166 | ): Promise<FastifyReply | void> => { |
| 167 | if (!isAllowed(req.headers.host)) { |
| 168 | return reply.code(403).send(errEnvelope(HOST_ERROR_CODE, formatHostErrorMessage(req.headers.host), req.id)); |
| 169 | } |
| 170 | }; |
| 171 | return { onRequest, isAllowed }; |
| 172 | } |
nothing calls this directly
no test coverage detected