Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with PhpBrowser and Guzzle6 connector #2896

Closed
Samorai opened this issue Mar 11, 2016 · 1 comment
Closed

Problem with PhpBrowser and Guzzle6 connector #2896

Samorai opened this issue Mar 11, 2016 · 1 comment

Comments

@Samorai
Copy link

@Samorai Samorai commented Mar 11, 2016

Hi.
I have some flow:

$I->amHttpAuthenticated($user, $password);
/** Do something  Need logout. For logout I do: */
$I->amHttpAuthenticated(null, null);
/**Need bearer Authentication*/
$I->amBearerAuthenticated($token);

But in result I am not bearer authenticated, I am Http authenticated with null:null credentials.

Connector Guzzle6 has not method to access protected variable $requestOptions;

I purpose change body of method setAuth to

if (is_null($username) && is_null($password)) {
    unset($this->requestOptions['auth']);
} else {
    $this->requestOptions['auth'] = [$username, $password];
}

https://github.com/Codeception/Codeception/blob/2.1.6/src/Codeception/Lib/Connector/Guzzle6.php#L81

@DavertMik
Copy link
Member

@DavertMik DavertMik commented Mar 11, 2016

Thanks. I think this can be simplified like:

if (!$username) {
    unset($this->requestOptions['auth']);
    return;
}
$this->requestOptions['auth'] = [$username, $password];

I will include it into GuzzleConnector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.