-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Support negotiation wildcards, fix #391 #1112
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1112 +/- ##
=========================================
+ Coverage 98.49% 98.5% +<.01%
=========================================
Files 41 41
Lines 2064 2070 +6
=========================================
+ Hits 2033 2039 +6
Misses 19 19
Partials 12 12
Continue to review full report at Codecov.
|
@appleboy please help review the pull request, thanks! |
@@ -1158,17 +1158,41 @@ func TestContextNegotiationFormat(t *testing.T) { | |||
func TestContextNegotiationFormatWithAccept(t *testing.T) { | |||
c, _ := CreateTestContext(httptest.NewRecorder()) | |||
c.Request, _ = http.NewRequest("POST", "/", nil) | |||
c.Request.Header.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") | |||
c.Request.Header.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9;q=0.8") | |||
|
|||
assert.Equal(t, MIMEXML, c.NegotiateFormat(MIMEJSON, MIMEXML)) | |||
assert.Equal(t, MIMEHTML, c.NegotiateFormat(MIMEXML, MIMEHTML)) | |||
assert.Empty(t, c.NegotiateFormat(MIMEJSON)) |
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.
This change is causing a regression in my app. What is the recommended way to achieve the previous behavior? I want to check if Accept
explicitly contains MIMEJSON.
Support negotiation wildcards, fix #391.