Skip to content

Commit

Permalink
Merge pull request #1 from samtgarson/patch-1
Browse files Browse the repository at this point in the history
Get the rest of the args and pass to handlers
  • Loading branch information
jamo authored Feb 15, 2017
2 parents 94f057a + 3c355c2 commit 1f24921
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = exports = function (map) {
const allowed_verbs = Object.keys(map).map(v => v.toUpperCase()).join(', ')

return (req, res) => {
return (req, res, ...args) => {
res.setHeader('Access-Control-Request-Method', allowed_verbs)
const {method} = req
const fn = map[method.toLowerCase()]
Expand All @@ -10,6 +10,6 @@ module.exports = exports = function (map) {
res.end('Method Not Allowed')
return
}
return fn(req, res)
return fn(req, res, ...args)
}
}

0 comments on commit 1f24921

Please sign in to comment.