Skip to content

Commit

Permalink
* added test for #195.
Browse files Browse the repository at this point in the history
  • Loading branch information
nahi committed Jan 22, 2009
1 parent 62b8a2f commit d202412
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_httpclient.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -165,11 +165,28 @@ def test_proxy
# #
@proxyio.string = "" @proxyio.string = ""
@client.proxy = @proxyurl @client.proxy = @proxyurl
@client.debug_dev = str = ""
assert_equal(200, @client.head(@url).status) assert_equal(200, @client.head(@url).status)
assert(/accept/ =~ @proxyio.string) assert(/accept/ =~ @proxyio.string)
assert(/Host: localhost:17171/ =~ str)
end end
end end


def test_host_header
@client.proxy = @proxyurl
@client.debug_dev = str = ""
@client.test_loopback_http_response << "HTTP/1.0 200 OK\r\n\r\n"
assert_equal(200, @client.head('http://www.example.com/foo').status)
# ensure no ':80' is added. some servers dislike that.
assert(/\r\nHost: www\.example\.com\r\n/ =~ str)
#
@client.debug_dev = str = ""
@client.test_loopback_http_response << "HTTP/1.0 200 OK\r\n\r\n"
assert_equal(200, @client.head('http://www.example.com:12345/foo').status)
# ensure ':12345' exists.
assert(/\r\nHost: www\.example\.com:12345\r\n/ =~ str)
end

def test_proxy_env def test_proxy_env
setup_proxyserver setup_proxyserver
escape_env do escape_env do
Expand Down

0 comments on commit d202412

Please sign in to comment.