@@ -18,7 +18,7 @@ def dummy_app
18
18
:verify_mode= => nil ,
19
19
:headers => { } ,
20
20
:status => 200 ,
21
- :body => "OK" ,
21
+ :body => "OK"
22
22
)
23
23
end
24
24
@@ -50,7 +50,7 @@ def app
50
50
51
51
it "parses the headers as a Hash with values of type String" do
52
52
stub_request ( :get , "http://example.com/test" ) . to_return (
53
- :headers => { "cache-control" => "max-age=300, public" } ,
53
+ :headers => { "cache-control" => "max-age=300, public" }
54
54
)
55
55
get "/test"
56
56
expect ( last_response . headers [ "cache-control" ] ) . to be_an_instance_of ( String )
@@ -68,8 +68,8 @@ def app
68
68
get "/test/stuff"
69
69
expect (
70
70
a_request ( :get , "http://example.com/test/stuff" ) . with (
71
- :headers => { "Host" => "example.com" } ,
72
- ) ,
71
+ :headers => { "Host" => "example.com" }
72
+ )
73
73
) . to have_been_made
74
74
end
75
75
@@ -78,8 +78,8 @@ def app
78
78
get "/test/stuff"
79
79
expect (
80
80
a_request ( :get , "http://example.com/test/stuff" ) . with (
81
- :headers => { "X-Forwarded-Host" => "example.org" } ,
82
- ) ,
81
+ :headers => { "X-Forwarded-Host" => "example.org" }
82
+ )
83
83
) . to have_been_made
84
84
end
85
85
@@ -96,7 +96,7 @@ def app
96
96
97
97
it "formats the headers correctly to avoid duplicates" do
98
98
stub_request ( :get , "http://example.com/2test" ) . to_return (
99
- :headers => { :date => "Wed, 22 Jul 2015 11:27:21 GMT" } ,
99
+ :headers => { :date => "Wed, 22 Jul 2015 11:27:21 GMT" }
100
100
)
101
101
102
102
get "/2test"
@@ -109,7 +109,7 @@ def app
109
109
it "formats the headers with dashes correctly" do
110
110
stub_request ( :get , "http://example.com/2test" ) . to_return (
111
111
:status => 301 ,
112
- :headers => { :status => "301 Moved Permanently" , :"x-additional-info" => "something" } ,
112
+ :headers => { :status => "301 Moved Permanently" , :"x-additional-info" => "something" }
113
113
)
114
114
115
115
get "/2test"
@@ -131,8 +131,8 @@ def app
131
131
get "/test/stuff"
132
132
expect (
133
133
a_request ( :get , "http://example.com:8080/test/stuff" ) . with (
134
- :headers => { "Host" => "example.com:8080" } ,
135
- ) ,
134
+ :headers => { "Host" => "example.com:8080" }
135
+ )
136
136
) . to have_been_made
137
137
end
138
138
end
@@ -150,8 +150,8 @@ def app
150
150
151
151
expect (
152
152
a_request ( :get , "http://example.com/test/stuff" ) . with (
153
- :headers => { "Host" => "example.com" } ,
154
- ) ,
153
+ :headers => { "Host" => "example.com" }
154
+ )
155
155
) . not_to have_been_made
156
156
157
157
expect ( a_request ( :get , "http://example.com/test/stuff" ) ) . to have_been_made
@@ -171,8 +171,8 @@ def app
171
171
get "/test/stuff"
172
172
expect (
173
173
a_request ( :get , "http://example.com/test/stuff" ) . with (
174
- :headers => { "X-Forwarded-Host" => "example.org" } ,
175
- ) ,
174
+ :headers => { "X-Forwarded-Host" => "example.org" }
175
+ )
176
176
) . not_to have_been_made
177
177
expect ( a_request ( :get , "http://example.com/test/stuff" ) ) . to have_been_made
178
178
end
@@ -217,7 +217,7 @@ def app
217
217
218
218
it "makes request with basic auth" do
219
219
stub_request ( :get , "http://joe:[email protected] /test/stuff" ) . to_return (
220
- :body => "secured content" ,
220
+ :body => "secured content"
221
221
)
222
222
get "/test/stuff"
223
223
expect ( last_response . body ) . to eq ( "secured content" )
@@ -233,15 +233,15 @@ def app
233
233
234
234
it "replaces the location response header" do
235
235
stub_request ( :get , "http://example.com/test/stuff" ) . to_return (
236
- :headers => { "location" => "http://test.com/bar" } ,
236
+ :headers => { "location" => "http://test.com/bar" }
237
237
)
238
238
get "http://example.com/test/stuff"
239
239
expect ( last_response . headers [ "location" ] ) . to eq ( "http://example.com/bar" )
240
240
end
241
241
242
242
it "keeps the port of the location" do
243
243
stub_request ( :get , "http://example.com/test/stuff" ) . to_return (
244
- :headers => { "location" => "http://test.com/bar" } ,
244
+ :headers => { "location" => "http://test.com/bar" }
245
245
)
246
246
get "http://example.com:3000/test/stuff"
247
247
expect ( last_response . headers [ "location" ] ) . to eq ( "http://example.com:3000/bar" )
@@ -302,7 +302,7 @@ def app
302
302
303
303
it "makes a secure request" do
304
304
stub_request ( :get , "https://example.com/test/stuff" ) . to_return (
305
- :body => "Proxied Secure App" ,
305
+ :body => "Proxied Secure App"
306
306
)
307
307
get "/test/stuff"
308
308
expect ( last_response . body ) . to eq ( "Proxied Secure App" )
@@ -313,8 +313,8 @@ def app
313
313
get "/test/stuff"
314
314
expect (
315
315
a_request ( :get , "https://example.com/test/stuff" ) . with (
316
- :headers => { "Host" => "example.com" } ,
317
- ) ,
316
+ :headers => { "Host" => "example.com" }
317
+ )
318
318
) . to have_been_made
319
319
end
320
320
end
@@ -331,8 +331,8 @@ def app
331
331
get "/test/stuff"
332
332
expect (
333
333
a_request ( :get , "https://example.com:8443/test/stuff" ) . with (
334
- :headers => { "Host" => "example.com:8443" } ,
335
- ) ,
334
+ :headers => { "Host" => "example.com:8443" }
335
+ )
336
336
) . to have_been_made
337
337
end
338
338
end
@@ -375,7 +375,7 @@ def app
375
375
describe "and using method #{ method } " do
376
376
it "forwards the correct request" do
377
377
stub_request ( method . to_sym , "http://example.com/test" ) . to_return (
378
- :body => "Proxied App for #{ method } " ,
378
+ :body => "Proxied App for #{ method } "
379
379
)
380
380
send ( method , "/test" )
381
381
expect ( last_response . body ) . to eq ( "Proxied App for #{ method } " )
@@ -385,7 +385,7 @@ def app
385
385
it "forwards the request payload" do
386
386
stub_request (
387
387
method . to_sym ,
388
- "http://example.com/test" ,
388
+ "http://example.com/test"
389
389
) . to_return { |req | { :body => req . body } }
390
390
send ( method , "/test" , :test => "test" )
391
391
expect ( last_response . body ) . to eq ( "test=test" )
@@ -467,7 +467,7 @@ def app
467
467
468
468
it "proxies requests when a pattern is matched" do
469
469
stub_request ( :get , "http://users-example.com/users?user=omer" ) . to_return (
470
- :body => "User App" ,
470
+ :body => "User App"
471
471
)
472
472
473
473
get "/test" , :user => "mark"
@@ -500,15 +500,15 @@ def app
500
500
501
501
it "proxies requests when a pattern is matched and correct headers are passed" do
502
502
stub_request ( :get , "http://example.com/test" ) . to_return (
503
- :body => "Proxied App with Headers" ,
503
+ :body => "Proxied App with Headers"
504
504
)
505
505
get "/test" , { } , "HTTP_ACCEPT" => "foo.bar"
506
506
expect ( last_response . body ) . to eq ( "Proxied App with Headers" )
507
507
end
508
508
509
509
it "does not proxy requests when a pattern is matched and incorrect headers are passed" do
510
510
stub_request ( :get , "http://example.com/test" ) . to_return (
511
- :body => "Proxied App with Headers" ,
511
+ :body => "Proxied App with Headers"
512
512
)
513
513
get "/test" , { } , "HTTP_ACCEPT" => "bar.foo"
514
514
expect ( last_response . body ) . not_to eq ( "Proxied App with Headers" )
0 commit comments