MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / apply

Function apply

packages/hono/src/shared/patchAppRequest.ts:41–65  ·  view source on GitHub ↗
(_target, thisArg, args: [string | Request | URL, RequestInit?, ...unknown[]])

Source from the content-addressed store, hash-verified

39
40 app.request = new Proxy(originalRequest, {
41 apply(_target, thisArg, args: [string | Request | URL, RequestInit?, ...unknown[]]) {
42 const [input, requestInit, ...rest] = args;
43
44 if (!getActiveSpan()) {
45 return Reflect.apply(_target, thisArg, args);
46 }
47
48 let method = requestInit?.method ?? (input instanceof Request ? input.method : 'GET');
49 method = method.toUpperCase();
50
51 const path = extractPathname(input);
52
53 return startSpan(
54 {
55 name: `${method} ${path}`,
56 op: INTERNAL_REQUEST_OP,
57 onlyIfParent: true,
58 attributes: {
59 [SEMANTIC_ATTRIBUTE_SENTRY_OP]: INTERNAL_REQUEST_OP,
60 [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: INTERNAL_REQUEST_ORIGIN,
61 },
62 },
63 () => Reflect.apply(_target, thisArg, [input, requestInit, ...rest]),
64 );
65 },
66 get(target, prop, receiver) {
67 if (prop === '__sentry_original__') {
68 return originalRequest;

Callers

nothing calls this directly

Calls 4

getActiveSpanFunction · 0.90
startSpanFunction · 0.90
extractPathnameFunction · 0.85
applyMethod · 0.45

Tested by

no test coverage detected