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

Method handle

packages/server/src/adapters/node/handler.ts:42–69  ·  view source on GitHub ↗
(
    request: NodeHttpRequest,
    response: NodeHttpResponse,
    ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>
  )

Source from the content-addressed store, hash-verified

40 }
41
42 async handle(
43 request: NodeHttpRequest,
44 response: NodeHttpResponse,
45 ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>
46 ): Promise<NodeHttpHandleResult> {
47 return intercept(
48 this.adapterInterceptors,
49 {
50 ...resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest)),
51 request,
52 response,
53 sendStandardResponseOptions: this.sendStandardResponseOptions,
54 },
55 async ({ request, response, sendStandardResponseOptions, ...options }) => {
56 const standardRequest = toStandardLazyRequest(request, response)
57
58 const result = await this.standardHandler.handle(standardRequest, options)
59
60 if (!result.matched) {
61 return { matched: false }
62 }
63
64 await sendStandardResponse(response, result.response, sendStandardResponseOptions)
65
66 return { matched: true }
67 },
68 )
69 }
70}

Callers 5

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