From bf615609473e41ade06addc21c096de62946b6ab Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Thu, 13 Aug 2020 18:39:47 -0500 Subject: [PATCH] Fixed malformed method calls in allowAll feature. --- index.js | 6 ++++-- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 3052bbf..bb0d91d 100644 --- a/index.js +++ b/index.js @@ -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) } } diff --git a/package-lock.json b/package-lock.json index 989c63a..1ba6063 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@butlerlogic/common-api", - "version": "1.5.5", + "version": "1.5.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4ca06dc..3ccb0b3 100644 --- a/package.json +++ b/package.json @@ -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": {