Make Api Gateway custom domain work (with basepath)#32
Make Api Gateway custom domain work (with basepath)#32sloev merged 7 commits intosloev:mastersloev/python-lambdarest:masterfrom svdgraaf:feature/make-custom-endpoints-workCopy head branch name to clipboard
Conversation
|
when tests are green i can code review it, thanks again for contribution @svdgraaf ! |
|
after reading up on it, i am not convinced that the resource behaves as mentioned. can you @svdgraaf supply me with a request json output (aws to lambda request object) from both cases, with / without custom domain. |
|
Hmmm, let me check and get those for you |
|
Without custom domain (see the Host header): With custom domain: |
|
Do you have any links where you read about the resource not being correct to use? Because then we need to figure something else out to make this compatible |
|
from what you have shown it looks like it should more be: but then why not always resource instead of path? |
|
i think what i meant with resource being weird is the example shows that you can use some kind of path params in the resource field |
|
Yeah, I think we can just default to the resource key. I'll check how that behaves when it is setup with |
|
Ok, figured it out, and changed things accordingly. As discussed it now uses the The {proxy+} is now also supported, if that is given in the event, the path parameter "proxy" contains the actual value for that part of the path. So I just replace that with the actual value, and the routing works. I changed the readme to use |
|
great work @svdgraaf !
(3) i think a fallback is unnecessary, the switch from path to resource should work and not convolute the code with fallbacks. |
|
I'm currently testing it with apigw, found a bug, working on it :) |
…aaf/python-lambdarest into feature/make-custom-endpoints-work
|
Ok, the bug was my bad :D https://api.tsentlzwoot.com/v2/foobar/asdfsdf/asdfsdf/asdfasdf/asdfasdf/
|
* if resource is set in request, use that instead of path
* Added support for the {proxy+} endpoint. Default to "resource" event key
* Cleanup, and added check for start of / in path.
* bump version
* bump version write history
* Fixed bad * path
When APIGW is setup with a custom domain. The path to the call will include the basepath (if setup). To fix this, we need to check for the
resourcepath which will contain the actual path without the basepath.This fixes #31