From 0de1b60ca423320249e78b50fb7db8727467f2dc Mon Sep 17 00:00:00 2001 From: Tushar Choudhari Date: Wed, 15 Nov 2023 11:22:51 +0530 Subject: [PATCH] Remove check for isWrapped --- src/clients/express.ts | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/clients/express.ts b/src/clients/express.ts index e0bd25b..77e92f8 100644 --- a/src/clients/express.ts +++ b/src/clients/express.ts @@ -13,20 +13,18 @@ export const instrumentExpress = ( const routerProto = express.Router as unknown as Express.Router['prototype']; - if (isWrapped(routerProto, 'use')) { - wrap(routerProto, 'use', (original) => { - return function wrappedUse( - this: typeof original, - ...args: Parameters - ) { - if (!redMiddlewareAdded) { - original.apply(this, [redMiddleware]); - redMiddlewareAdded = true; - } - return original.apply(this, args); - }; - }); - } + wrap(routerProto, 'use', (original) => { + return function wrappedUse( + this: typeof original, + ...args: Parameters + ) { + if (!redMiddlewareAdded) { + original.apply(this, [redMiddleware]); + redMiddlewareAdded = true; + } + return original.apply(this, args); + }; + }); if (!isWrapped(express.application, 'listen')) { wrap(