Skip to content

Fix handling of trailing slash to match API Gateway#588

Closed
stealthycoin wants to merge 1 commit into
aws:masterfrom
stealthycoin:local-trailing-slash
Closed

Fix handling of trailing slash to match API Gateway#588
stealthycoin wants to merge 1 commit into
aws:masterfrom
stealthycoin:local-trailing-slash

Conversation

@stealthycoin
Copy link
Copy Markdown
Contributor

API Gateway will not match a URI against a route that has a capture
group as the last path component if that capture group would be filled
with an empty string. Example:

With the route:
/resource/{name}

/resource/bob matches
/resource/ does not match

Previously local mode would match both URIs to that route, setting the
name parameter to an empty string.

closes #582

@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 31, 2017

Codecov Report

Merging #588 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #588      +/-   ##
==========================================
+ Coverage   94.68%   94.69%   +0.01%     
==========================================
  Files          18       18              
  Lines        3179     3185       +6     
  Branches      413      414       +1     
==========================================
+ Hits         3010     3016       +6     
  Misses        118      118              
  Partials       51       51
Impacted Files Coverage Δ
chalice/local.py 98.28% <100%> (+0.01%) ⬆️
chalice/cli/__init__.py 82.16% <100%> (+0.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f95051d...a50e33d. Read the comment docs.

@stealthycoin stealthycoin force-pushed the local-trailing-slash branch 3 times, most recently from fa7ff96 to cbda2fd Compare November 6, 2017 18:49
API Gateway will not match a URI against a route that has a capture
group as the last path component if that capture group would be filled
with an empty string. Example:

With the route:
/resource/{name}

/resource/bob matches
/resource/    does not match

Previously local mode would match both URIs to that route, setting the
name parameter to an empty string.

closes aws#582

This change also prvents `chalice local` from running if there is a
route that ends with a / since `chalice deploy` will not let you deploy
such routes.
@jamesls
Copy link
Copy Markdown
Member

jamesls commented Nov 16, 2017

Looks good, I'm just going to add another test. I want a test that verifies if you have /a and /a/{capture} that a request to /a/ will route to /a.

I'll also go ahead and rebase on master.

jamesls added a commit that referenced this pull request Nov 16, 2017
PR #588

* stealthycoin-local-trailing-slash:
  Update test with latest changes from master
  Add additional test for trailing slash
  Fix handling of trailing slash to match API Gateway
@jamesls
Copy link
Copy Markdown
Member

jamesls commented Nov 16, 2017

Merged in bd05f56

@jamesls jamesls closed this Nov 16, 2017
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.

No route found - exposing too much information?

3 participants