@@ -107,7 +107,7 @@ func TestRequestWithBody(t *testing.T) {
107107func TestRequestWithGZipEncodedBody (t * testing.T ) {
108108a := assert .New (t )
109109
110- data , _ , err := ToObject [testResponse ](Request ("" , RequestOptions {
110+ data , resp , err := ToObject [testResponse ](Request ("" , RequestOptions {
111111BaseURL : "http://localhost:8080" ,
112112Headers : map [string ][]string {
113113"Accept-Encoding" : {"gzip" , "deflate" },
@@ -117,12 +117,13 @@ func TestRequestWithGZipEncodedBody(t *testing.T) {
117117
118118a .NotNilNow (data .Method )
119119a .EqualNow (* data .Method , "GET" )
120+ a .NotTrueNow (resp .Header .Get ("Content-Encoding" ))
120121}
121122
122123func TestRequestWithDeflateEncodedBody (t * testing.T ) {
123124a := assert .New (t )
124125
125- data , _ , err := ToObject [testResponse ](Request ("" , RequestOptions {
126+ data , resp , err := ToObject [testResponse ](Request ("" , RequestOptions {
126127BaseURL : "http://localhost:8080" ,
127128Headers : map [string ][]string {
128129"Accept-Encoding" : {"deflate" },
@@ -132,6 +133,7 @@ func TestRequestWithDeflateEncodedBody(t *testing.T) {
132133
133134a .NotNilNow (data .Method )
134135a .EqualNow (* data .Method , "GET" )
136+ a .NotTrueNow (resp .Header .Get ("Content-Encoding" ))
135137}
136138
137139func TestRequestWithInvalidContentEncoding (t * testing.T ) {
@@ -160,6 +162,21 @@ func TestRequestWithInvalidContentEncoding(t *testing.T) {
160162a .NotNilNow (err )
161163}
162164
165+ func TestRequestWithContentEncodingAndDisableDecompress (t * testing.T ) {
166+ a := assert .New (t )
167+
168+ resp , err := Request ("" , RequestOptions {
169+ BaseURL : "http://localhost:8080" ,
170+ Headers : map [string ][]string {
171+ "Accept-Encoding" : {"gzip" , "deflate" },
172+ },
173+ DisableDecompress : true ,
174+ })
175+ a .NilNow (err )
176+
177+ a .EqualNow (resp .Header .Get ("Content-Encoding" ), "gzip" )
178+ }
179+
163180func TestRequestWithParameters (t * testing.T ) {
164181a := assert .New (t )
165182
0 commit comments