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

normalize request path takes into account localhost #20

Merged
merged 3 commits into from
May 3, 2019
Merged

normalize request path takes into account localhost #20

merged 3 commits into from
May 3, 2019

Conversation

napicella
Copy link

@napicella napicella commented Apr 9, 2019

When using sam local the host is set to localhost.
In this case the path does not need to be normalized.

Details

Without this change, the router removes the first part of the url path, i.e.

> curl -H 'Content-Type: application/json; Host: http://whatever' -X PUT -d '{"message" : "hello" }' http://localhost:3000/a/b/c
{"message":"Could not find matching action for /b/c and method PUT","error":"NO_MATCHING_ACTION"}

Basically /a was removed from the path.

The fix

Check if the Host is localhost. In this case, just skip normalization.

- When using sam local the host is set to localhost.
  In this case the path does not need to be normalized.
- When using sam local the host is set to localhost.
  In this case the path does not need to be normalized.
@jzlai
Copy link
Contributor

jzlai commented Apr 30, 2019

Sorry for getting back to you so late to you. I know it's only a small change but could you add a test please? Thank you

@napicella
Copy link
Author

Hi! No problem.
Yes, I have added a test in the proxy integration spec. Thanks!

-Nicola

@chgohlke
Copy link
Member

chgohlke commented May 3, 2019

@napicella Top, thanks.

@chgohlke chgohlke merged commit ab65fe2 into spring-media:master May 3, 2019
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.

None yet

4 participants