diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/test_request.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb index 5109c7b..0613326 100644 --- a/test/unit/test_request.rb +++ b/test/unit/test_request.rb @@ -55,7 +55,7 @@ class RequestTest < Test::Unit::TestCase assert_nothing_raised { res = @lint.call(env) } end - def test_x_forwarded_proto + def test_x_forwarded_proto_https res = env = nil client = MockRequest.new("GET / HTTP/1.1\r\n" \ "X-Forwarded-Proto: https\r\n" \ @@ -65,6 +65,16 @@ class RequestTest < Test::Unit::TestCase assert_nothing_raised { res = @lint.call(env) } end + def test_x_forwarded_proto_http + res = env = nil + client = MockRequest.new("GET / HTTP/1.1\r\n" \ + "X-Forwarded-Proto: http\r\n" \ + "Host: foo\r\n\r\n") + assert_nothing_raised { env = @request.read(client) } + assert_equal "http", env['rack.url_scheme'] + assert_nothing_raised { res = @lint.call(env) } + end + def test_x_forwarded_proto_invalid res = env = nil client = MockRequest.new("GET / HTTP/1.1\r\n" \ |