mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
using punycode name as the authority in the headers, which is actually a bugfix
This commit is contained in:
parent
4df2363cc5
commit
0c7712ca88
@ -78,7 +78,7 @@ module HTTPX
|
||||
|
||||
def authority
|
||||
port_string = port == default_port ? nil : ":#{port}"
|
||||
"#{@non_ascii_hostname || host}#{port_string}"
|
||||
"#{host}#{port_string}"
|
||||
end
|
||||
|
||||
def origin
|
||||
|
@ -17,12 +17,12 @@ module ResponseHelpers
|
||||
if value.respond_to?(:start_with?)
|
||||
assert value.start_with?(expect), "#{meth} assertion failed: \#{key}=\#{value} (expected: \#{expect}})"
|
||||
else
|
||||
assert value == expect, "#{meth} assertion failed: \#{key}=\#{value.to_s} (expected: \#{expect.to_s})"
|
||||
assert value == expect, "#{meth} assertion failed: \#{key}=\#{value.inspect} (expected: \#{expect.to_s})"
|
||||
end
|
||||
end
|
||||
|
||||
def verify_no_#{meth}(#{meth}s, key)
|
||||
assert !#{meth}s.key?(key), "#{meth}s contains the given key (" + key + ": \#{#{meth}s[key]})"
|
||||
assert !#{meth}s.key?(key), "#{meth}s contains the given key (" + key + ": \#{#{meth}s[key].inspect})"
|
||||
end
|
||||
DEFINE
|
||||
end
|
||||
|
@ -96,8 +96,12 @@ module Requests
|
||||
|
||||
def test_get_idn
|
||||
response = HTTPX.get("http://bücher.ch")
|
||||
verify_status(response, 200)
|
||||
verify_status(response, 301)
|
||||
verify_header(response.headers, "location", "https://www.buecher.de")
|
||||
|
||||
response.close
|
||||
|
||||
assert response.instance_variable_get(:@request).authority == "xn--bcher-kva.ch"
|
||||
end unless RUBY_VERSION < "2.3"
|
||||
|
||||
def test_get_non_ascii
|
||||
|
Loading…
x
Reference in New Issue
Block a user