@@ -38,34 +38,35 @@ def app
38
38
last_response . body . should == "Proxied App2"
39
39
end
40
40
41
- it "the response header should never contain Status" do
42
- stub_request ( :any , 'example.com/test/stuff' ) . to_return ( :headers => { 'Status' => '200 OK' } )
43
- get '/test/stuff'
44
- last_response . headers [ 'Status' ] . should == nil
45
- end
46
-
47
- it "the response header should never transfer-encoding" do
48
- stub_request ( :any , 'example.com/test/stuff' ) . to_return ( :headers => { 'transfer-encoding' => 'Chunked' } )
49
- get '/test/stuff'
50
- last_response . headers [ 'transfer-encoding' ] . should == nil
51
- end
52
-
53
- it "should set the Host header" do
54
- stub_request ( :any , 'example.com/test/stuff' )
55
- get '/test/stuff'
56
- a_request ( :get , 'http://example.com/test/stuff' ) . with ( :headers => { "Host" => "example.com" } ) . should have_been_made
57
- end
41
+ it "the response header should never contain Status" do
42
+ stub_request ( :any , 'example.com/test/stuff' ) . to_return ( :headers => { 'Status' => '200 OK' } )
43
+ get '/test/stuff'
44
+ last_response . headers [ 'Status' ] . should == nil
45
+ end
46
+
47
+ it "the response header should never transfer-encoding" do
48
+ stub_request ( :any , 'example.com/test/stuff' ) . to_return ( :headers => { 'transfer-encoding' => 'Chunked' } )
49
+ get '/test/stuff'
50
+ last_response . headers [ 'transfer-encoding' ] . should == nil
51
+ end
52
+
53
+ it "should set the Host header" do
54
+ stub_request ( :any , 'example.com/test/stuff' )
55
+ get '/test/stuff'
56
+ a_request ( :get , 'http://example.com/test/stuff' ) . with ( :headers => { "Host" => "example.com" } ) . should have_been_made
57
+ end
58
58
59
59
describe "with preserve host turned off" do
60
60
def app
61
61
Rack ::ReverseProxy . new ( dummy_app ) do
62
- reverse_proxy '/test' , 'http://example.com/'
62
+ reverse_proxy '/test' , 'http://example.com/' , { :preserve_host => false }
63
63
end
64
64
end
65
65
66
66
it "should not set the Host header" do
67
67
stub_request ( :any , 'example.com/test/stuff' )
68
68
get '/test/stuff'
69
+ a_request ( :get , 'http://example.com/test/stuff' ) . with ( :headers => { "Host" => "example.com" } ) . should_not have_been_made
69
70
a_request ( :get , 'http://example.com/test/stuff' ) . should have_been_made
70
71
end
71
72
end
@@ -108,9 +109,9 @@ def app
108
109
end
109
110
110
111
it "should throw an exception" do
111
- stub_request ( :get , 'http://example1.com/test' ) . to_return ( { :body => "Proxied App" } )
112
- get '/test'
113
- last_response . body . should == "Proxied App"
112
+ stub_request ( :get , 'http://example1.com/test' ) . to_return ( { :body => "Proxied App" } )
113
+ get '/test'
114
+ last_response . body . should == "Proxied App"
114
115
end
115
116
end
116
117
@@ -128,20 +129,20 @@ def app
128
129
end
129
130
end
130
131
131
- describe "with a https route" do
132
+ describe "with a https route" do
132
133
def app
133
134
Rack ::ReverseProxy . new ( dummy_app ) do
134
135
reverse_proxy '/test' , 'https://example.com'
135
136
end
136
137
end
137
138
138
- it "should make a secure request" do
139
+ it "should make a secure request" do
139
140
stub_request ( :get , 'https://example.com/test/stuff' ) . to_return ( { :body => "Proxied Secure App" } )
140
141
get '/test/stuff'
141
142
last_response . body . should == "Proxied Secure App"
142
- end
143
+ end
143
144
144
- end
145
+ end
145
146
146
147
describe "with a route as a string" do
147
148
def app
0 commit comments