summaryrefslogtreecommitdiff
path: root/vendor/guzzlehttp/guzzle/src/Client.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzlehttp/guzzle/src/Client.php')
-rw-r--r--vendor/guzzlehttp/guzzle/src/Client.php40
1 files changed, 23 insertions, 17 deletions
diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php
index 58f1d89..bc6efc9 100644
--- a/vendor/guzzlehttp/guzzle/src/Client.php
+++ b/vendor/guzzlehttp/guzzle/src/Client.php
@@ -120,13 +120,14 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
public function send(RequestInterface $request, array $options = []): ResponseInterface
{
$options[RequestOptions::SYNCHRONOUS] = true;
+
return $this->sendAsync($request, $options)->wait();
}
/**
* The HttpClient PSR (PSR-18) specify this method.
*
- * @inheritDoc
+ * {@inheritDoc}
*/
public function sendRequest(RequestInterface $request): ResponseInterface
{
@@ -184,6 +185,7 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
public function request(string $method, $uri = '', array $options = []): ResponseInterface
{
$options[RequestOptions::SYNCHRONOUS] = true;
+
return $this->requestAsync($method, $uri, $options)->wait();
}
@@ -200,7 +202,7 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
*
* @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0.
*/
- public function getConfig(?string $option = null)
+ public function getConfig(string $option = null)
{
return $option === null
? $this->config
@@ -228,11 +230,11 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
{
$defaults = [
'allow_redirects' => RedirectMiddleware::$defaultSettings,
- 'http_errors' => true,
- 'decode_content' => true,
- 'verify' => true,
- 'cookies' => false,
- 'idn_conversion' => false,
+ 'http_errors' => true,
+ 'decode_content' => true,
+ 'verify' => true,
+ 'cookies' => false,
+ 'idn_conversion' => false,
];
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
@@ -354,10 +356,10 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
if (isset($options['form_params'])) {
if (isset($options['multipart'])) {
throw new InvalidArgumentException('You cannot use '
- . 'form_params and multipart at the same time. Use the '
- . 'form_params option if you want to send application/'
- . 'x-www-form-urlencoded requests, and the multipart '
- . 'option to send multipart/form-data requests.');
+ .'form_params and multipart at the same time. Use the '
+ .'form_params option if you want to send application/'
+ .'x-www-form-urlencoded requests, and the multipart '
+ .'option to send multipart/form-data requests.');
}
$options['body'] = \http_build_query($options['form_params'], '', '&');
unset($options['form_params']);
@@ -403,7 +405,7 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
// Ensure that we don't have the header in different case and set the new value.
$modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']);
$modify['set_headers']['Authorization'] = 'Basic '
- . \base64_encode("$value[0]:$value[1]");
+ .\base64_encode("$value[0]:$value[1]");
break;
case 'digest':
// @todo: Do not rely on curl
@@ -437,13 +439,17 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
}
}
+ if (isset($options['version'])) {
+ $modify['version'] = $options['version'];
+ }
+
$request = Psr7\Utils::modifyRequest($request, $modify);
if ($request->getBody() instanceof Psr7\MultipartStream) {
// Use a multipart/form-data POST if a Content-Type is not set.
// Ensure that we don't have the header in different case and set the new value.
$options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']);
$options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
- . $request->getBody()->getBoundary();
+ .$request->getBody()->getBoundary();
}
// Merge in conditional headers if they are not present.
@@ -469,9 +475,9 @@ class Client implements ClientInterface, \Psr\Http\Client\ClientInterface
private function invalidBody(): InvalidArgumentException
{
return new InvalidArgumentException('Passing in the "body" request '
- . 'option as an array to send a request is not supported. '
- . 'Please use the "form_params" request option to send a '
- . 'application/x-www-form-urlencoded request, or the "multipart" '
- . 'request option to send a multipart/form-data request.');
+ .'option as an array to send a request is not supported. '
+ .'Please use the "form_params" request option to send a '
+ .'application/x-www-form-urlencoded request, or the "multipart" '
+ .'request option to send a multipart/form-data request.');
}
}