Add support for greedy catch-all path variables #2012
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was attempted/discussed in #140, but here is a more complete and also tested implementation.
API Gateway has support for "greedy" path parameters in API routes, but that is not fully supported in Chalice. We have run into several use cases for such a feature in our company:
Currently, if you specify a
{proxy+}
path variable in an@app.route
, it will actually work, but there are a few things lacking:chalice local
)Those gaps are implemented in this PR. Usage would be as follows:
This will match any url under
/foo
(although not/foo
itself), returning the proxied portion of the path:The PR also adds support local development (
chalice local
) so that the matching also works locally just as it does in API Gateway.