summaryrefslogtreecommitdiff
path: root/test/spec_urlmap.rb
diff options
context:
space:
mode:
authorJamie Woods <jamie.woods@bbc.co.uk>2018-04-11 12:15:18 +0100
committerJamie Woods <jamie.woods@bbc.co.uk>2018-04-11 12:15:18 +0100
commit13dce5667f4009c9b600270ab7eb55cd8dc22495 (patch)
tree0bd87181778d35a201b71f02f2627349884050c5 /test/spec_urlmap.rb
parentc15733d76851651600f5ded5f03bfd7a40544af3 (diff)
downloadrack-13dce5667f4009c9b600270ab7eb55cd8dc22495.tar.gz
Update URLMap to default to empty host, if HTTP_HOST (and hence HTTP_X_FORWARED_HOST) is defined, fixing 990
Diffstat (limited to 'test/spec_urlmap.rb')
-rw-r--r--test/spec_urlmap.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/spec_urlmap.rb b/test/spec_urlmap.rb
index 9d655c22..f88ee606 100644
--- a/test/spec_urlmap.rb
+++ b/test/spec_urlmap.rb
@@ -117,6 +117,14 @@ describe Rack::URLMap do
res.must_be :ok?
res["X-Position"].must_equal "default.org"
+ res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "any-host.org")
+ res.must_be :ok?
+ res["X-Position"].must_equal "default.org"
+
+ res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "any-host.org", "HTTP_X_FORWARDED_HOST" => "any-host.org")
+ res.must_be :ok?
+ res["X-Position"].must_equal "default.org"
+
res = Rack::MockRequest.new(map).get("/",
"HTTP_HOST" => "example.org:9292",
"SERVER_PORT" => "9292")