@@ -12,7 +12,6 @@ def dummy_app
12
12
lambda { [ 200 , { } , [ 'Dummy App' ] ] }
13
13
end
14
14
15
-
16
15
describe "as middleware" do
17
16
def app
18
17
Rack ::ReverseProxy . new ( dummy_app ) do
@@ -32,6 +31,18 @@ def app
32
31
last_response . body . should == "Proxied App"
33
32
end
34
33
34
+ it "the response header should never contain Status" do
35
+ stub_request ( :any , 'example.com/test/stuff' ) . to_return ( :headers => { 'Status' => '200 OK' } )
36
+ get '/test/stuff'
37
+ last_response . headers [ 'Status' ] . should == nil
38
+ end
39
+
40
+ it "should set the Host header" do
41
+ stub_request ( :any , 'example.com/test/stuff' )
42
+ get '/test/stuff'
43
+ a_request ( :get , 'http://example.com/test/stuff' ) . with ( :headers => { "Host" => "example.com" } ) . should have_been_made
44
+ end
45
+
35
46
describe "with ambiguous routes" do
36
47
def app
37
48
Rack ::ReverseProxy . new ( dummy_app ) do
@@ -66,11 +77,12 @@ def app
66
77
end
67
78
end
68
79
69
- it "should rewrite HOST " do
70
- stub_request ( :get , 'https://example.com/test/stuff' ) . with ( :headers => { "Host" => "example.com" } ) . to_return ( { :body => "Proxied App" } )
80
+ it "should make a secure request " do
81
+ stub_request ( :get , 'https://example.com/test/stuff' ) . to_return ( { :body => "Proxied Secure App" } )
71
82
get '/test/stuff'
72
- last_response . body . should == "Proxied App"
83
+ last_response . body . should == "Proxied Secure App"
73
84
end
85
+
74
86
end
75
87
76
88
describe "with a route as a string" do
0 commit comments