diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-14 22:26:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 22:26:19 +0100 |
commit | 24f96513fde993268c1286ded393252020d4f9ae (patch) | |
tree | 4da55bdec980bc7ecf6452fce1e4d3515f5be9eb /build/integration/features/bootstrap/Auth.php | |
parent | 236086c457672742eb3ff57acf66587549b69345 (diff) | |
parent | a815185bb4960312b6e15cda236db09d8ca72c01 (diff) | |
download | nextcloud-server-24f96513fde993268c1286ded393252020d4f9ae.tar.gz nextcloud-server-24f96513fde993268c1286ded393252020d4f9ae.zip |
Merge pull request #8259 from nextcloud/guzzle6
update guzzlehttp/guzzle to 6.3.0
Diffstat (limited to 'build/integration/features/bootstrap/Auth.php')
-rw-r--r-- | build/integration/features/bootstrap/Auth.php | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/build/integration/features/bootstrap/Auth.php b/build/integration/features/bootstrap/Auth.php index b185dd0b8c8..da2698b429a 100644 --- a/build/integration/features/bootstrap/Auth.php +++ b/build/integration/features/bootstrap/Auth.php @@ -59,18 +59,20 @@ trait Auth { $fullUrl = substr($this->baseUrl, 0, -5) . $url; try { if ($useCookies) { - $request = $this->client->createRequest($method, $fullUrl, [ + $options = [ 'cookies' => $this->cookieJar, - ]); + ]; } else { - $request = $this->client->createRequest($method, $fullUrl); + $options = []; } if ($authHeader) { - $request->setHeader('Authorization', $authHeader); + $options['headers'] = [ + 'Authorization' => $authHeader + ]; } - $request->setHeader('OCS_APIREQUEST', 'true'); - $request->setHeader('requesttoken', $this->requestToken); - $this->response = $this->client->send($request); + $options['headers']['OCS_APIREQUEST'] = 'true'; + $options['headers']['requesttoken'] = $this->requestToken; + $this->response = $this->client->request($method, $fullUrl, $options); } catch (ClientException $ex) { $this->response = $ex->getResponse(); } catch (ServerException $ex) { @@ -90,7 +92,7 @@ trait Auth { * @return object */ private function createClientToken($loginViaWeb = true) { - if($loginViaWeb) { + if ($loginViaWeb) { $this->loggingInUsingWebAs('user0'); } @@ -101,7 +103,7 @@ trait Auth { 'user0', $loginViaWeb ? '123456' : $this->restrictedClientToken, ], - 'body' => [ + 'form_params' => [ 'requesttoken' => $this->requestToken, 'name' => md5(microtime()), ], @@ -109,7 +111,7 @@ trait Auth { ]; try { - $this->response = $client->send($client->createRequest('POST', $fullUrl, $options)); + $this->response = $client->request('POST', $fullUrl, $options); } catch (\GuzzleHttp\Exception\ServerException $e) { $this->response = $e->getResponse(); } @@ -119,7 +121,7 @@ trait Auth { /** * @Given a new restricted client token is added */ - public function aNewRestrictedClientTokenIsAdded() { + public function aNewRestrictedClientTokenIsAdded() { $tokenObj = $this->createClientToken(); $newCreatedTokenId = $tokenObj->deviceToken->id; $fullUrl = substr($this->baseUrl, 0, -5) . '/index.php/settings/personal/authtokens/' . $newCreatedTokenId; @@ -136,7 +138,7 @@ trait Auth { ], 'cookies' => $this->cookieJar, ]; - $this->response = $client->send($client->createRequest('PUT', $fullUrl, $options)); + $this->response = $client->request('PUT', $fullUrl, $options); $this->restrictedClientToken = $tokenObj->token; } @@ -232,13 +234,13 @@ trait Auth { $client = new Client(); $response = $client->post( $loginUrl, [ - 'body' => [ - 'user' => 'user0', - 'password' => '123456', - 'remember_login' => $remember ? '1' : '0', - 'requesttoken' => $this->requestToken, - ], - 'cookies' => $this->cookieJar, + 'form_params' => [ + 'user' => 'user0', + 'password' => '123456', + 'remember_login' => $remember ? '1' : '0', + 'requesttoken' => $this->requestToken, + ], + 'cookies' => $this->cookieJar, ] ); $this->extracRequestTokenFromResponse($response); |