1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-24 01:53:58 +01:00

Merge pull request #1459 from Tobion/patch-1

Fix strange auth option handling
This commit is contained in:
Michael Dowling 2016-05-08 12:30:22 -07:00
commit 2c0556b78f

View File

@ -325,13 +325,10 @@ class Client implements ClientInterface
unset($options['body']);
}
if (!empty($options['auth'])) {
if (!empty($options['auth']) && is_array($options['auth'])) {
$value = $options['auth'];
$type = is_array($value)
? (isset($value[2]) ? strtolower($value[2]) : 'basic')
: $value;
$config['auth'] = $value;
switch (strtolower($type)) {
$type = isset($value[2]) ? strtolower($value[2]) : 'basic';
switch ($type) {
case 'basic':
$modify['set_headers']['Authorization'] = 'Basic '
. base64_encode("$value[0]:$value[1]");