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

Support negotiation wildcards, fix #391 #1112

Merged
merged 6 commits into from Mar 1, 2019

Conversation

Equim-chan
Copy link
Contributor

Support negotiation wildcards, fix #391.

@codecov
Copy link

codecov bot commented Sep 17, 2017

Codecov Report

Merging #1112 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
context.go 98.36% <100%> (+0.02%) ⬆️

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 9bacadd...abf0a0b. Read the comment docs.

@appleboy appleboy added this to the 1.3 milestone Sep 28, 2017
@appleboy appleboy modified the milestones: 1.3, 1.4 Aug 14, 2018
@appleboy appleboy requested review from thinkerou and removed request for tboerger and nazwa August 14, 2018 09:20
@thinkerou
Copy link
Member

@appleboy please help review the pull request, thanks!

@thinkerou thinkerou merged commit 2dd3193 into gin-gonic:master Mar 1, 2019
@@ -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))
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support HTTP content negotiation wildcards
4 participants