mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-09 00:02:50 -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
|
||||
end
|
||||
|
||||
{
|
||||
ssl: ssl_options_from_env(env),
|
||||
timeout: timeout_options,
|
||||
}
|
||||
end
|
||||
|
||||
if defined?(::OpenSSL)
|
||||
def ssl_options_from_env(env)
|
||||
ssl_options = {}
|
||||
|
||||
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[: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: ssl_options,
|
||||
timeout: timeout_options,
|
||||
}
|
||||
ssl_options
|
||||
end
|
||||
else
|
||||
def ssl_options_from_env(*)
|
||||
{}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -4,4 +4,8 @@ require "socket"
|
||||
require "httpx/io/udp"
|
||||
require "httpx/io/tcp"
|
||||
require "httpx/io/unix"
|
||||
|
||||
begin
|
||||
require "httpx/io/ssl"
|
||||
rescue LoadError
|
||||
end
|
||||
|
@ -23,6 +23,16 @@ module Requests
|
||||
verify_status(response, 304)
|
||||
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
|
||||
session = HTTPX.plugin(:follow_redirects)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user