Skip to content

Commit 129189b

Browse files
authored
feat(remix): Skip span creation for OPTIONS and HEAD requests. [v7] (#11485)
Backports #11149 to `v7`
1 parent 43b83a6 commit 129189b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/remix/src/utils/instrumentServer.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ function wrapRequestHandler(origRequestHandler: RequestHandler, build: ServerBui
446446
return origRequestHandler.call(this, request, loadContext);
447447
}
448448

449+
const upperCaseMethod = request.method.toUpperCase();
450+
451+
// We don't want to wrap OPTIONS and HEAD requests
452+
if (upperCaseMethod === 'OPTIONS' || upperCaseMethod === 'HEAD') {
453+
return origRequestHandler.call(this, request, loadContext);
454+
}
455+
449456
return runWithAsyncContext(async () => {
450457
// eslint-disable-next-line deprecation/deprecation
451458
const hub = getCurrentHub();

0 commit comments

Comments
 (0)