From a63b8434b571b34aa117f8537de0ecbc7e369f1a Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Mon, 28 Aug 2023 11:33:47 +0200 Subject: [PATCH 1/2] Revert "Add Accept-Encoding: gzip header to requests" This reverts commit eb94782b49f9ef7f3ded60a23398376e3c1bef6b. --- chttp/chttp.go | 1 - chttp/chttp_test.go | 39 +++++++++++++++------------------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/chttp/chttp.go b/chttp/chttp.go index 32d9667f..9d9e06f2 100644 --- a/chttp/chttp.go +++ b/chttp/chttp.go @@ -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) { diff --git a/chttp/chttp_test.go b/chttp/chttp_test.go index 7585e0b5..0e051e60 100644 --- a/chttp/chttp_test.go +++ b/chttp/chttp_test.go @@ -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"}, }, }, { @@ -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"}, }, }, @@ -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"`}, }, }, } @@ -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 { @@ -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) From 7722886d586ef885a2f9ed9afa1f232ed0c9a5bb Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Mon, 28 Aug 2023 11:34:49 +0200 Subject: [PATCH 2/2] Bump version constant prior to release --- chttp/chttp.go | 2 +- constants.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chttp/chttp.go b/chttp/chttp.go index 9d9e06f2..a2dff78a 100644 --- a/chttp/chttp.go +++ b/chttp/chttp.go @@ -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 diff --git a/constants.go b/constants.go index b5b9a7e0..e3c09b8e 100644 --- a/constants.go +++ b/constants.go @@ -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`