Conversation
… feature/cors_support Add cors support using aws#1009 as a ref
|
@viksrivat Can you handle the merge conflicts here? I will do a quick pass over once you do that. |
ApiGateway::RestApi only supports within methods section. This requires parsing the requestParameters section of the ApiGateway resource. Since we currently don'd do this, the best functionality is to ignore cors in RestApi
jfuss
left a comment
There was a problem hiding this comment.
Some of this will need to be changed based on other prs you have in process. Once the stage pr is merged, you should rebase here and handle the comments. Overall, this looks good and would love to get this into a release soon, as this will be a great addition for customers.
| if cors_prop and isinstance(cors_prop, dict): | ||
| allow_methods = cors_prop.get("AllowMethods", ','.join(Route.ANY_HTTP_METHODS)) | ||
|
|
||
| if allow_methods and "OPTIONS" not in allow_methods and "options" not in allow_methods: |
There was a problem hiding this comment.
You need to normalize allow_methods here, just comparing OPTIONS and options is not enough, unless SAM or API gateway only allow these two ways for the strings.
| try: | ||
| event = self._construct_event(request, self.port, self.api.binary_media_types, self.api.stage_name, | ||
| self.api.stage_variables) | ||
| self.api.stage_variables, cors_headers) |
There was a problem hiding this comment.
Is this right? Cors_headers always get added to the event?
There was a problem hiding this comment.
Yes. I believe CORS needs to be added to every request.
|
Is this branch ready to merge to candidate 20 branch? I see there are new commits added after the approval. |
|
The only changes that I added were updating some of the integration tests for Travis CI to pass. |
|
Updated this to track and merge into develop. |
|
@viksrivat Can you fix the flake8 errors: Running |
Issue #, if available:
Description of changes:
Adds Cors support to ApiGateway. This completes the #1009 pr
Checklist:
make prpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.