MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / wrappedHandler

Function wrappedHandler

packages/web/src/lib/apiHandler.ts:43–55  ·  view source on GitHub ↗
(request: NextRequest, ...rest: unknown[])

Source from the content-addressed store, hash-verified

41 const { track = true } = config;
42
43 const wrappedHandler = async (request: NextRequest, ...rest: unknown[]) => {
44 if (track) {
45 const path = request.nextUrl.pathname;
46 const method = request.method;
47 const source = request.headers.get('X-Sourcebot-Client-Source') ?? 'unknown';
48
49 // Fire and forget - don't await to avoid blocking the request
50 captureEvent('api_request', { path, method, source });
51 }
52
53 // Call the original handler with all arguments
54 return handler(request, ...rest);
55 };
56
57 return wrappedHandler as H;
58}

Callers

nothing calls this directly

Calls 2

captureEventFunction · 0.90
handlerFunction · 0.85

Tested by

no test coverage detected