Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
return wrapped;
}
return middleware;
};
try {
let Koa = require('koa');
let originalUse = Koa.prototype.use;
Koa.prototype.use = function (middleware) {
let wrapped = wrapMiddleware(middleware);
return originalUse.call(this, wrapped);
};
Koa.prototype.use._original = originalUse;
registerWrapped(Koa.prototype, 'use');
try {
const Router = require('koa-router');
let originalRegister = Router.prototype.register;
Router.prototype.register = function () {
let middlewares = Array.isArray(arguments[2]) ? arguments[2] : [arguments[2]];
let wrappedMiddlewares = middlewares.map(middleware => wrapMiddleware(middleware));
arguments[2] = wrappedMiddlewares;
return originalRegister.apply(this, arguments);
};
Router.prototype.register._original = originalRegister;
return wrapped;
}
return middleware;
};
try {
let Koa = require('koa');
let originalUse = Koa.prototype.use;
Koa.prototype.use = function (middleware) {
let wrapped = wrapMiddleware(middleware);
return originalUse.call(this, wrapped);
};
Koa.prototype.use._original = originalUse;
registerWrapped(Koa.prototype, 'use');
try {
const Router = require('koa-router');
let originalRegister = Router.prototype.register;
Router.prototype.register = function () {
let middlewares = Array.isArray(arguments[2]) ? arguments[2] : [arguments[2]];
let wrappedMiddlewares = middlewares.map(middleware => wrapMiddleware(middleware));
arguments[2] = wrappedMiddlewares;
return originalRegister.apply(this, arguments);
};
Router.prototype.register._original = originalRegister;
registerWrapped(Router.prototype, 'register');
throw e;
} finally {
endTracer();
}
};
return wrapped;
}
return middleware;
};
try {
let Koa = require('koa');
let originalUse = Koa.prototype.use;
Koa.prototype.use = function (middleware) {
let wrapped = wrapMiddleware(middleware);
return originalUse.call(this, wrapped);
};
Koa.prototype.use._original = originalUse;
registerWrapped(Koa.prototype, 'use');
try {
const Router = require('koa-router');
let originalRegister = Router.prototype.register;
Router.prototype.register = function () {
let middlewares = Array.isArray(arguments[2]) ? arguments[2] : [arguments[2]];
let wrappedMiddlewares = middlewares.map(middleware => wrapMiddleware(middleware));
} catch (e) {
throw e;
} finally {
endTracer();
}
};
return wrapped;
}
return middleware;
};
try {
let Koa = require('koa');
let originalUse = Koa.prototype.use;
Koa.prototype.use = function (middleware) {
let wrapped = wrapMiddleware(middleware);
return originalUse.call(this, wrapped);
};
Koa.prototype.use._original = originalUse;
registerWrapped(Koa.prototype, 'use');
try {
const Router = require('koa-router');
let originalRegister = Router.prototype.register;
Router.prototype.register = function () {
let middlewares = Array.isArray(arguments[2]) ? arguments[2] : [arguments[2]];
let wrappedMiddlewares = middlewares.map(middleware => wrapMiddleware(middleware));