MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / onRequest

Function onRequest

packages/server/src/middleware/hostnames.ts:163–170  ·  view source on GitHub ↗
(
    req: FastifyRequest,
    reply: FastifyReply,
  )

Source from the content-addressed store, hash-verified

161export 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}

Callers

nothing calls this directly

Calls 5

errEnvelopeFunction · 0.90
isAllowedFunction · 0.85
formatHostErrorMessageFunction · 0.85
sendMethod · 0.65
codeMethod · 0.65

Tested by

no test coverage detected