Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"ext-json": "*",
"codeception/codeception": "*@dev",
"codeception/lib-innerbrowser": "*@dev",
"guzzlehttp/guzzle": "^7.4",
"guzzlehttp/guzzle": "^7.8.2 | ^8.0",
"guzzlehttp/psr7": "^2.6.3 | ^3.0",
"symfony/browser-kit": "^5.4 | ^6.0 | ^7.0 | ^8.0"
},
"require-dev": {
Expand Down
8 changes: 5 additions & 3 deletions src/Codeception/Lib/Connector/Guzzle.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,13 @@ protected function doRequest(object $request): object
$response = $this->client->send($guzzleRequest, $options);
}
} catch (RequestException $exception) {
if (!$exception->hasResponse()) {
// Guzzle 7 exposes the response on RequestException itself,
// Guzzle 8 only on its ResponseException subclass.
$response = method_exists($exception, 'getResponse') ? $exception->getResponse() : null;

if ($response === null) {
throw $exception;
}

$response = $exception->getResponse();
}

// @phpstan-ignore-next-line
Expand Down
2 changes: 1 addition & 1 deletion src/Codeception/Module/PhpBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* url: 'http://localhost' # Internationalized domain names (IDN) need to be passed in punycode
* auth: ['admin', '123345']
* curl:
* CURLOPT_RETURNTRANSFER: true
* CURLOPT_TCP_KEEPALIVE: true
Comment thread
W0rma marked this conversation as resolved.
* cookies:
* cookie-1:
* Name: userName
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/Codeception/Module/PhpBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ public function testCurlSslOptions(): void
$this->module->_setConfig([
'url' => 'https://github.com',
'curl' => [
'CURLOPT_NOBODY' => true,
'CURLOPT_SSL_CIPHER_LIST' => 'TLSv1',
]]);
$this->module->_initialize();
Expand All @@ -407,7 +406,7 @@ public function testCurlSslOptions(): void
$this->assertArrayHasKey('curl', $config);
$this->assertArrayHasKey(CURLOPT_SSL_CIPHER_LIST, $config['curl']);
$this->module->amOnPage('/');
$this->assertSame('', $this->module->_getResponseContent(), 'CURLOPT_NOBODY setting is not respected');
$this->module->seeResponseCodeIsSuccessful();
}

public function testHttpAuth(): void
Expand Down