@@ -147,6 +147,20 @@ def app
147
147
expect ( last_response . headers [ "Content-Length" ] ) . to eq ( body . length . to_s )
148
148
end
149
149
150
+ it "does not include Accept-Encoding header" do
151
+ stub_request ( :any , "http://example.com/test" )
152
+
153
+ get "/test" , { } , "HTTP_ACCEPT_ENCODING" => "gzip, deflate"
154
+
155
+ expect (
156
+ a_request ( :get , "http://example.com/test" ) . with (
157
+ :headers => { "Accept-Encoding" => "gzip, deflate" }
158
+ )
159
+ ) . not_to have_been_made
160
+
161
+ expect ( a_request ( :get , "http://example.com/test" ) ) . to have_been_made
162
+ end
163
+
150
164
describe "with non-default port" do
151
165
def app
152
166
Rack ::ReverseProxy . new ( dummy_app ) do
@@ -186,6 +200,26 @@ def app
186
200
end
187
201
end
188
202
203
+ describe "with preserve encoding turned on" do
204
+ def app
205
+ Rack ::ReverseProxy . new ( dummy_app ) do
206
+ reverse_proxy "/test" , "http://example.com/" , :preserve_encoding => true
207
+ end
208
+ end
209
+
210
+ it "sets the Accept-Encoding header" do
211
+ stub_request ( :any , "http://example.com/test" )
212
+
213
+ get "/test" , { } , "HTTP_ACCEPT_ENCODING" => "gzip, deflate"
214
+
215
+ expect (
216
+ a_request ( :get , "http://example.com/test" ) . with (
217
+ :headers => { "Accept-Encoding" => "gzip, deflate" }
218
+ )
219
+ ) . to have_been_made
220
+ end
221
+ end
222
+
189
223
describe "with x_forwarded_headers turned off" do
190
224
def app
191
225
Rack ::ReverseProxy . new ( dummy_app ) do
0 commit comments