Skip to content

Commit

Permalink
Add PUT to simple CORS method.
Browse files Browse the repository at this point in the history
  • Loading branch information
coreybutler committed Aug 13, 2020
1 parent c02369b commit e2d0950
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ This method applies 3 response headers to all responses:

- `Access-Control-Allow-Origin`: By default, this is set to `*`, but the host can be modified by passing an optional 2nd argument to the function.
- `Access-Control-Allow-Headers`: Set to `'Origin, X-Requested-With, Content-Type, Accept'`
- `Access-Control-Allow-Methods`: Set to `GET, POST, PATCH, DELETE, OPTIONS`
- `Access-Control-Allow-Methods`: Set to `GET, POST, PUT, PATCH, DELETE, OPTIONS`

## allowHeaders('Origin', 'X-Requested-With')

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class Endpoint {
app.use((req, res, next) => {
this.allowOrigins(host)(req, res)
this.allowHeaders('Origin', 'X-Requested-With', 'Content-Type', 'Accept')(req, res)
this.allowMethods('GET', 'POST', 'PATCH', 'DELETE', 'OPTIONS')(req, res)
this.allowMethods('GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS')(req, res)

// Support preflight requests
if (req.method.toUpperCase() === 'OPTIONS') {
Expand Down
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.1",
"version": "1.5.2",
"description": "An API engineering productivity kit for Express.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e2d0950

Please sign in to comment.