toxy
Version:
Hackable HTTP proxy to simulate server failure scenarios and network conditions
15 lines (12 loc) • 318 B
JavaScript
module.exports = function method (matchMethod) {
if (typeof matchMethod === 'string') {
matchMethod = [ matchMethod ]
}
if (!matchMethod) {
matchMethod = [ 'GET' ]
}
return function method (req, res, next) {
const notMatches = !~matchMethod.indexOf(req.method)
next(null, notMatches)
}
}