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

RawPath and Unescape URL parameters #777

Closed
wants to merge 7 commits into from

Conversation

gcnathan
Copy link

This patch aims to fix issue #722 and PR #640 .

I'm currently developing an API with URL parameters with, for example :
GET /user/:username

By assuming that username can contains special encoded parameters :

  • Jon%20Doe
  • Slash%2FMe

The first one is not decoded by using c.Params("username").
The second one, using '/' is currently not working at all.

Using the '*' character does not fix the issue as I've got sub routes :
GET /user/:username/infos

Feel free to comment. It aims to be a not-breaking change.

@codecov-io
Copy link

codecov-io commented Dec 29, 2016

Current coverage is 93.12% (diff: 75.00%)

Merging #777 into develop will decrease coverage by 0.12%

@@            develop       #777   diff @@
==========================================
  Files            16         16          
  Lines          1305       1310     +5   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           1217       1220     +3   
- Misses           76         77     +1   
- Partials         12         13     +1   

Powered by Codecov. Last update df2e95c...b018f7c

@gcnathan gcnathan closed this Dec 29, 2016
@gcnathan gcnathan reopened this Dec 29, 2016
@gcnathan gcnathan changed the base branch from master to develop Dec 29, 2016
@egorse
Copy link
Contributor

egorse commented Feb 11, 2017

Any hopes to get it merged?

@@ -276,14 +279,17 @@ func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {
func (engine *Engine) handleHTTPRequest(context *Context) {
httpMethod := context.Request.Method
path := context.Request.URL.Path
if engine.UseRawPath && len(context.Request.URL.RawPath) > 0 {
path = context.Request.URL.RawPath
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gcnathan Could you write testing to improve code coverage? Thanks.

@appleboy
Copy link
Member

@gcnathan Any updates on this?

@gcnathan
Copy link
Author

@appleboy I'll check on how to do it. To be honest, it's quite the first time I'm playing with code coverage, so I'll check :)

@appleboy
Copy link
Member

appleboy commented Feb 14, 2017

@egorse create another PR to improve this feature. You can follow up #803 this thread. @gcnathan

@appleboy
Copy link
Member

closed via #810

@appleboy appleboy closed this Feb 28, 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.

None yet

5 participants