mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-10 00:02:10 -04:00
Merge branch 'issue-252' into 'master'
test for follow redirect with relative paths Closes #252 See merge request os85/httpx!287
This commit is contained in:
commit
8f54afe7b3
@ -80,6 +80,14 @@ module Faraday
|
|||||||
timeout_options[:connect_timeout] = sec
|
timeout_options[:connect_timeout] = sec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
{
|
||||||
|
ssl: ssl_options_from_env(env),
|
||||||
|
timeout: timeout_options,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
if defined?(::OpenSSL)
|
||||||
|
def ssl_options_from_env(env)
|
||||||
ssl_options = {}
|
ssl_options = {}
|
||||||
|
|
||||||
unless env.ssl.verify.nil?
|
unless env.ssl.verify.nil?
|
||||||
@ -95,11 +103,12 @@ module Faraday
|
|||||||
ssl_options[:verify_depth] = env.ssl.verify_depth if env.ssl.verify_depth
|
ssl_options[:verify_depth] = env.ssl.verify_depth if env.ssl.verify_depth
|
||||||
ssl_options[:min_version] = env.ssl.min_version if env.ssl.min_version
|
ssl_options[:min_version] = env.ssl.min_version if env.ssl.min_version
|
||||||
ssl_options[:max_version] = env.ssl.max_version if env.ssl.max_version
|
ssl_options[:max_version] = env.ssl.max_version if env.ssl.max_version
|
||||||
|
ssl_options
|
||||||
{
|
end
|
||||||
ssl: ssl_options,
|
else
|
||||||
timeout: timeout_options,
|
def ssl_options_from_env(*)
|
||||||
}
|
{}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,4 +4,8 @@ require "socket"
|
|||||||
require "httpx/io/udp"
|
require "httpx/io/udp"
|
||||||
require "httpx/io/tcp"
|
require "httpx/io/tcp"
|
||||||
require "httpx/io/unix"
|
require "httpx/io/unix"
|
||||||
require "httpx/io/ssl"
|
|
||||||
|
begin
|
||||||
|
require "httpx/io/ssl"
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
@ -23,6 +23,16 @@ module Requests
|
|||||||
verify_status(response, 304)
|
verify_status(response, 304)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_plugin_follow_redirects_relative_path
|
||||||
|
session = HTTPX.plugin(:follow_redirects)
|
||||||
|
uri = redirect_uri("../get")
|
||||||
|
|
||||||
|
redirect_response = session.get(uri)
|
||||||
|
body = json_body(redirect_response)
|
||||||
|
assert body.key?("url"), "url should be set"
|
||||||
|
assert body["url"] == redirect_location, "url should have been the given redirection url"
|
||||||
|
end
|
||||||
|
|
||||||
def test_plugin_follow_redirects_default_max_redirects
|
def test_plugin_follow_redirects_default_max_redirects
|
||||||
session = HTTPX.plugin(:follow_redirects)
|
session = HTTPX.plugin(:follow_redirects)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user