diff --git a/library/Requests.php b/library/Requests.php index 49489c0a5..9e2a2e1e9 100755 --- a/library/Requests.php +++ b/library/Requests.php @@ -323,7 +323,7 @@ public static function patch($url, $headers, $data = array(), $options = array() * for Basic authentication * (Requests_Auth|array|boolean, default: false) * - `proxy`: Proxy details to use for proxy by-passing and authentication - * (Requests_Proxy|array|boolean, default: false) + * (Requests_Proxy|array|string|boolean, default: false) * - `max_bytes`: Limit for the response body size. * (integer|boolean, default: false) * - `idn`: Enable IDN parsing @@ -575,7 +575,7 @@ protected static function set_defaults(&$url, &$headers, &$data, &$type, &$optio $options['auth']->register($options['hooks']); } - if (!empty($options['proxy'])) { + if (is_string($options['proxy']) || is_array($options['proxy'])) { $options['proxy'] = new Requests_Proxy_HTTP($options['proxy']); } if ($options['proxy'] !== false) { diff --git a/tests/Proxy/HTTP.php b/tests/Proxy/HTTP.php index 351570dfe..3d81745de 100644 --- a/tests/Proxy/HTTP.php +++ b/tests/Proxy/HTTP.php @@ -79,7 +79,7 @@ public function testConnectWithInstance($transport) { $this->checkProxyAvailable(); $options = array( - 'proxy' => REQUESTS_HTTP_PROXY, + 'proxy' => new Requests_Proxy_HTTP(REQUESTS_HTTP_PROXY), 'transport' => $transport, ); $response = Requests::get(httpbin('/get'), array(), $options); @@ -128,4 +128,4 @@ public function testConnectWithInvalidAuth($transport) { $response = Requests::get(httpbin('/get'), array(), $options); $this->assertEquals(407, $response->status_code); } -} \ No newline at end of file +}