MCPcopy Create free account
hub / github.com/middleapi/orpc / handle

Method handle

packages/server/src/adapters/fastify/handler.ts:34–61  ·  view source on GitHub ↗
(
    request: FastifyRequest,
    reply: FastifyReply,
    ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>
  )

Source from the content-addressed store, hash-verified

32 }
33
34 async handle(
35 request: FastifyRequest,
36 reply: FastifyReply,
37 ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>
38 ): Promise<FastifyHandleResult> {
39 return intercept(
40 this.adapterInterceptors,
41 {
42 ...resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest)),
43 request,
44 reply,
45 sendStandardResponseOptions: this.sendStandardResponseOptions,
46 },
47 async ({ request, reply, sendStandardResponseOptions, ...options }) => {
48 const standardRequest = toStandardLazyRequest(request, reply)
49
50 const result = await this.standardHandler.handle(standardRequest, options)
51
52 if (!result.matched) {
53 return { matched: false }
54 }
55
56 await sendStandardResponse(reply, result.response, sendStandardResponseOptions)
57
58 return { matched: true }
59 },
60 )
61 }
62}

Callers 3

handler.test-d.tsFile · 0.45
handler.test.tsFile · 0.45

Calls 5

interceptFunction · 0.90
toStandardLazyRequestFunction · 0.90
sendStandardResponseFunction · 0.90

Tested by

no test coverage detected