Skip to content

Commit

Permalink
Fixed malformed method calls in allowAll feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
coreybutler committed Aug 13, 2020
1 parent 7f1be8b commit bf61560
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,12 @@ class Endpoint {

allowAll (host = '*') {
return (req, res, next) => {
const methods = new Set(Array.from(HTTP_METHODS).slice(0))

this.allowOrigins(...(arguments.length > 0 ? arguments : [host]))(req, res)
this.allowMethods(req.method)(req, res)
this.allowMethods(...Array.from(methods))(req, res)
this.allowHeaders(...Object.keys(req.headers))(req, res)
this.allowPreflight(req, res, next)
this.allowPreflight()(req, res, next)
}
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@butlerlogic/common-api",
"version": "1.5.5",
"version": "1.5.6",
"description": "An API engineering productivity kit for Express.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit bf61560

Please sign in to comment.