test/spec_rack_urlmap.rb in rack-0.9.1 vs test/spec_rack_urlmap.rb in rack-1.0.0
- old
+ new
@@ -66,10 +66,16 @@
[200,
{ "Content-Type" => "text/plain",
"X-Position" => "foo.org",
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
}, [""]]},
+ "http://subdomain.foo.org/" => lambda { |env|
+ [200,
+ { "Content-Type" => "text/plain",
+ "X-Position" => "subdomain.foo.org",
+ "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
+ }, [""]]},
"http://bar.org/" => lambda { |env|
[200,
{ "Content-Type" => "text/plain",
"X-Position" => "bar.org",
"X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
@@ -91,9 +97,13 @@
res["X-Position"].should.equal "bar.org"
res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "foo.org")
res.should.be.ok
res["X-Position"].should.equal "foo.org"
+
+ res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "subdomain.foo.org", "SERVER_NAME" => "foo.org")
+ res.should.be.ok
+ res["X-Position"].should.equal "subdomain.foo.org"
res = Rack::MockRequest.new(map).get("http://foo.org/")
res.should.be.ok
res["X-Position"].should.equal "default.org"