- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.5k
 
Logger skip paths allow params #3144
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
base: master
Are you sure you want to change the base?
Conversation
259a946    to
    0407401      
    Compare
  
    ff9cc35    to
    e08f574      
    Compare
  
    This is more flexible and is breaking only in very rare cases. Restore original behavior Update logger path skipping tests
e08f574    to
    40991b4      
    Compare
  
    | 
           @appleboy @thinkerou Please take a look. Thanks in advance!  | 
    
    
      
        1 similar comment
      
    
  
    | 
           @appleboy @thinkerou Please take a look. Thanks in advance!  | 
    
| 
               | 
          ||
| buffer.Reset() | ||
| PerformRequest(router, "GET", "/loggedUsers/2") | ||
| assert.Contains(t, buffer.String(), "200") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.Contains(t, "200", buffer.String())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for leaving your feedback @appleboy. I just want to confirm this is the change your want, since the current code base adopts the convention of assert.Contains(t, buffer.String(), "200"). I will change them all once confirmed. Let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hanyucui sorry for my mistake. you are right.
func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) boolThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for double-checking, @appleboy. Let me know if other changes are needed.
| router.GET("/skippedUsers/:id", func(c *Context) {}) | ||
| 
               | 
          ||
| PerformRequest(router, "GET", "/logged") | ||
| assert.Contains(t, buffer.String(), "200") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.Contains(t, "200", buffer.String())
| router.GET("/skippedUsers/:id", func(c *Context) {}) | ||
| 
               | 
          ||
| PerformRequest(router, "GET", "/logged") | ||
| assert.Contains(t, buffer.String(), "200") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.Contains(t, "200", buffer.String())
| 
               | 
          ||
| buffer.Reset() | ||
| PerformRequest(router, "GET", "/loggedUsers/2") | ||
| assert.Contains(t, buffer.String(), "200") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.Contains(t, "200", buffer.String())
| 
           Change milestone to v1.10  | 
    
This change adds support for skip paths with params, e.g.,
"/user/:id". This is more flexible and the implementation is simply
comparing
Context.FullPath()rather thanContext.Request.URL.Pathagainst skip paths.
The only case where it would lead to regression is where legacy code
uses hardcoded paths for parameterized paths. E.g., when hardcoded
paths like "/user/1" and "/user/2" are added to skipped paths for
"/user/:id". Although legal, I cannot imagine when such a case
would be useful. Hence I think regression would be extremely rare in
practice.
This change also updates relevant tests.