[HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm
This commit is contained in:
parent
f2e7158bc0
commit
ab1a96c999
@ -111,7 +111,7 @@ trait HttpClientTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
|
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, %s given.', \is_string($options['auth_bearer']) ? 'invalid string' : '"'.\gettype($options['auth_bearer']).'"'));
|
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, '.(\is_string($options['auth_bearer']) ? 'invalid string given.' : '"%s" given.'), \gettype($options['auth_bearer'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['auth_basic'], $options['auth_bearer'])) {
|
if (isset($options['auth_basic'], $options['auth_bearer'])) {
|
||||||
@ -197,6 +197,16 @@ trait HttpClientTrait
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('auth_ntlm' === $name) {
|
||||||
|
if (!\extension_loaded('curl')) {
|
||||||
|
$msg = 'try installing the "curl" extension to use "%s" instead.';
|
||||||
|
} else {
|
||||||
|
$msg = 'try using "%s" instead.';
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" is not supported by "%s", '.$msg, __CLASS__, CurlHttpClient::class));
|
||||||
|
}
|
||||||
|
|
||||||
$alternatives = [];
|
$alternatives = [];
|
||||||
|
|
||||||
foreach ($defaultOptions as $key => $v) {
|
foreach ($defaultOptions as $key => $v) {
|
||||||
@ -205,10 +215,6 @@ trait HttpClientTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('auth_ntlm' === $name) {
|
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" is not supported by "%s", try using CurlHttpClient instead.', __CLASS__));
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new InvalidArgumentException(sprintf('Unsupported option "%s" passed to "%s", did you mean "%s"?', $name, __CLASS__, implode('", "', $alternatives ?: array_keys($defaultOptions))));
|
throw new InvalidArgumentException(sprintf('Unsupported option "%s" passed to "%s", did you mean "%s"?', $name, __CLASS__, implode('", "', $alternatives ?: array_keys($defaultOptions))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user