Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected Access-Control-Allow-Methods for ANY HTTP events #3304

Merged
merged 3 commits into from
Mar 15, 2017

Conversation

jmannau
Copy link
Contributor

@jmannau jmannau commented Feb 27, 2017

The Access-Control-Allow-Methods OPTIONS response header for ANY http
verb requests now correctly includes all HTTP verbs.

What did you implement:

Closes #3303

How did you implement it:

This PR checks if the methods array includes the ANY verb. If so, it replaces the unrecognised ANY method in the Access-Control-Allow-Methods header with the correct HTTP verbs 'DELETE,GET,HEAD,PATCH,POST,PUT'.

How can we verify it:

The appropriate tests have been updated to include the ANY method.

-->

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

The Access-Control-Allow-Methods OPTIONS response header for ANY http
verb requests now correctly includes all HTTP verbs.
@@ -19,6 +19,11 @@ module.exports = {
'Access-Control-Allow-Credentials': `'${config.allowCredentials}'`,
};

if(config.methods.indexOf('ANY') > -1){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to use _.includes(config.methods, 'ANY') instead as it's clearer.

@jmannau
Copy link
Contributor Author

jmannau commented Mar 2, 2017

I have updated the PR as per your suggestion.

@eahefnawy
Copy link
Member

@jmannau Thanks for this fix! 👍 ... Could you please fix the linting issues so that the build passes and we can merge it?

@eahefnawy eahefnawy added this to the 1.10 milestone Mar 13, 2017
Copy link
Contributor

@pmuens pmuens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jmannau 👍

Just fixed the linting issues. Will merge once the build passes...

@pmuens pmuens merged commit 0784680 into serverless:master Mar 15, 2017
@msingleton
Copy link

just ran into this issue too, thanks @jmannau!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants