Skip to content

Commit

Permalink
Merge pull request #347 from go-kivik/retractGzip-v3
Browse files Browse the repository at this point in the history
Revert gzip accept headers
  • Loading branch information
flimzy authored Aug 28, 2023
2 parents c637049 + 7722886 commit 4367c26
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
3 changes: 1 addition & 2 deletions chttp/chttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const typeJSON = "application/json"
// The default UserAgent values
const (
UserAgent = "Kivik chttp"
Version = "3.4.0"
Version = "3.4.1"
)

// Client represents a client connection. It embeds an *http.Client
Expand Down Expand Up @@ -395,7 +395,6 @@ func setHeaders(req *http.Request, opts *Options) {
}
req.Header.Add("Accept", accept)
req.Header.Add("Content-Type", contentType)
req.Header.Add("Accept-Encoding", "gzip")
}

func setQuery(req *http.Request, opts *Options) {
Expand Down
39 changes: 15 additions & 24 deletions chttp/chttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,27 +249,24 @@ func TestSetHeaders(t *testing.T) {
{
Name: "NoOpts",
Expected: http.Header{
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"Accept-Encoding": {"gzip"},
"Accept": {"application/json"},
"Content-Type": {"application/json"},
},
},
{
Name: "Content-Type",
Options: &Options{ContentType: "image/gif"},
Expected: http.Header{
"Accept": {"application/json"},
"Accept-Encoding": {"gzip"},
"Content-Type": {"image/gif"},
"Accept": {"application/json"},
"Content-Type": {"image/gif"},
},
},
{
Name: "Accept",
Options: &Options{Accept: "image/gif"},
Expected: http.Header{
"Accept": {"image/gif"},
"Content-Type": {"application/json"},
"Accept-Encoding": {"gzip"},
"Accept": {"image/gif"},
"Content-Type": {"application/json"},
},
},
{
Expand All @@ -278,7 +275,6 @@ func TestSetHeaders(t *testing.T) {
Expected: http.Header{
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"Accept-Encoding": {"gzip"},
"X-Couch-Full-Commit": {"true"},
},
},
Expand All @@ -288,30 +284,27 @@ func TestSetHeaders(t *testing.T) {
HeaderDestination: []string{"somewhere nice"},
}},
Expected: http.Header{
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"Accept-Encoding": {"gzip"},
"Destination": {"somewhere nice"},
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"Destination": {"somewhere nice"},
},
},
{
Name: "If-None-Match",
Options: &Options{IfNoneMatch: `"foo"`},
Expected: http.Header{
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"Accept-Encoding": {"gzip"},
"If-None-Match": {`"foo"`},
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"If-None-Match": {`"foo"`},
},
},
{
Name: "Unquoted If-None-Match",
Options: &Options{IfNoneMatch: `foo`},
Expected: http.Header{
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"Accept-Encoding": {"gzip"},
"If-None-Match": {`"foo"`},
"Accept": {"application/json"},
"Content-Type": {"application/json"},
"If-None-Match": {`"foo"`},
},
},
}
Expand Down Expand Up @@ -748,7 +741,6 @@ func TestDoReq(t *testing.T) {
*success = true
expected := httptest.NewRequest("PUT", "/foo", nil)
expected.Header.Add("Accept", "application/json")
expected.Header.Add("Accept-Encoding", "gzip")
expected.Header.Add("Content-Type", "application/json")
expected.Header.Add("User-Agent", defaultUA)
if d := testy.DiffHTTPRequest(expected, r); d != nil {
Expand Down Expand Up @@ -777,7 +769,6 @@ func TestDoReq(t *testing.T) {
expected := httptest.NewRequest("PUT", "/foo", Body("bar"))
expected.Header.Add("Accept", "application/json")
expected.Header.Add("Content-Type", "application/json")
expected.Header.Add("Accept-Encoding", "gzip")
expected.Header.Add("User-Agent", defaultUA)
if d := testy.DiffHTTPRequest(expected, r); d != nil {
t.Error(d)
Expand Down
2 changes: 1 addition & 1 deletion constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package couchdb

// Version is the current version of this package.
const Version = "3.4.0"
const Version = "3.4.1"

const (
// OptionFullCommit is the option key used to set the `X-Couch-Full-Commit`
Expand Down

0 comments on commit 4367c26

Please sign in to comment.