mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-11-22 00:05:57 -05:00
added test for the socks5 non-happy path
This commit is contained in:
parent
b83d52a284
commit
201591e9fe
@ -18,7 +18,7 @@ module HTTPX
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def initialize: (uri: uri, ?username: string, ?password: string) -> untyped
|
def initialize: (uri: uri | URI::Generic, ?username: string, ?password: string) -> untyped
|
||||||
end
|
end
|
||||||
|
|
||||||
# def self.configure: (singleton(Session)) -> void
|
# def self.configure: (singleton(Session)) -> void
|
||||||
|
|||||||
@ -30,7 +30,7 @@ module Requests
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_plugin_http_proxy_auth_error
|
def test_plugin_http_proxy_auth_error
|
||||||
no_auth_proxy = URI.parse(http_proxy.first)
|
no_auth_proxy = URI(http_proxy.first)
|
||||||
return unless no_auth_proxy.user
|
return unless no_auth_proxy.user
|
||||||
|
|
||||||
no_auth_proxy.user = nil
|
no_auth_proxy.user = nil
|
||||||
@ -66,6 +66,17 @@ module Requests
|
|||||||
verify_body_length(response)
|
verify_body_length(response)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_plugin_socks5_proxy_error
|
||||||
|
proxy = URI(socks5_proxy.first)
|
||||||
|
proxy.password = nil
|
||||||
|
|
||||||
|
session = HTTPX.plugin(:proxy).with_proxy(uri: [proxy])
|
||||||
|
uri = build_uri("/get")
|
||||||
|
response = session.get(uri)
|
||||||
|
assert response.is_a?(HTTPX::ErrorResponse), "should be a response error"
|
||||||
|
assert response.error.is_a?(HTTPX::Socks5Error), "should be a socks 5 error"
|
||||||
|
end
|
||||||
|
|
||||||
def test_plugin_ssh_proxy
|
def test_plugin_ssh_proxy
|
||||||
skip if RUBY_ENGINE == "jruby"
|
skip if RUBY_ENGINE == "jruby"
|
||||||
session = HTTPX.plugin(:"proxy/ssh").with_proxy(uri: ssh_proxy,
|
session = HTTPX.plugin(:"proxy/ssh").with_proxy(uri: ssh_proxy,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user