Skip to content

Commit

Permalink
Add specs for underscore in host (rack#2072)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Apr 25, 2023
1 parent ccd445d commit ab360dd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/spec_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ class RackRequestTest < Minitest::Spec
req.host.must_be_nil
req.hostname.must_be_nil

req = make_request \
Rack::MockRequest.env_for("/", "HTTP_HOST" => "some_service:3001")
req.host.must_equal "some_service"
req.hostname.must_equal "some_service"

req = make_request \
Rack::MockRequest.env_for("/", "SERVER_NAME" => "example.org", "SERVER_PORT" => "9292")
req.host.must_equal "example.org"
Expand Down Expand Up @@ -303,6 +308,10 @@ class RackRequestTest < Minitest::Spec
Rack::MockRequest.env_for("/", "HTTP_HOST" => "www2.example.org:81")
req.port.must_equal 81

req = make_request \
Rack::MockRequest.env_for("/", "HTTP_HOST" => "some_service:3001")
req.port.must_equal 3001

req = make_request \
Rack::MockRequest.env_for("/", "SERVER_NAME" => "example.org", "SERVER_PORT" => "9292")
req.port.must_equal 9292
Expand Down

0 comments on commit ab360dd

Please sign in to comment.