MCPcopy Create free account
hub / github.com/Effect-TS/effect / handler

Function handler

packages/platform/bun/src/BunHttpServer.ts:159–171  ·  view source on GitHub ↗
(request: Request, server: BunServer<WebSocketContext>)

Source from the content-addressed store, hash-verified

157 }), middleware)
158
159 function handler(request: Request, server: BunServer<WebSocketContext>) {
160 return new Promise<Response>((resolve, _reject) => {
161 const context = Context.add(
162 services,
163 ServerRequest.HttpServerRequest,
164 new BunServerRequest(request, resolve, removeHost(request.url), server)
165 )
166 const fiber = Fiber.runIn(Effect.runForkWith(context)(httpEffect), scope)
167 request.signal.addEventListener("abort", () => {
168 fiber.interruptUnsafe(parent.id, Error.ClientAbort.annotation)
169 }, { once: true })
170 })
171 }
172
173 yield* Scope.addFinalizerExit(serveScope, () => {
174 const index = handlerStack.indexOf(handler)

Callers 15

runRawMethod · 0.70
onMessageFunction · 0.70
makeHttpClientFunction · 0.50
makeHttpClientFunction · 0.50
makeHttpClientFunction · 0.50
makeHttpClientFunction · 0.50
onMessageFunction · 0.50
onDataFunction · 0.50
getFunction · 0.50
getFunction · 0.50

Calls 4

interruptUnsafeMethod · 0.80
removeHostFunction · 0.70
addMethod · 0.65
addEventListenerMethod · 0.65

Tested by 6

makeHttpClientFunction · 0.40
makeHttpClientFunction · 0.40
makeHttpClientFunction · 0.40
makeHttpClientFunction · 0.40
getFunction · 0.40
getFunction · 0.40