mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-28 11:07:09 -05:00
Merge pull request #4009 from pbleser-oc/test/4008-fail-on-cut-off-responses
test(acceptance): fail on responses that are cut off after their headers
This commit is contained in:
1 file changed
+6
@@ -25,6 +25,7 @@ use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Cookie\CookieJar;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use GuzzleHttp\Exception\ResponseTransferException;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@@ -176,11 +177,16 @@ class HttpRequestHelper {
|
||||
|
||||
// The exceptions that might happen here include:
|
||||
// ConnectException - in that case there is no response. Don't catch the exception.
|
||||
// ResponseTransferException - the transfer broke off after the response headers,
|
||||
// e.g. because the server aborted the response. Its body is
|
||||
// incomplete, so don't pass it back as if it were the response.
|
||||
// RequestException - if there is something in the response then pass it back.
|
||||
// Otherwise, re-throw the exception.
|
||||
// GuzzleException - something else unexpected happened. Don't catch the exception.
|
||||
try {
|
||||
$response = $client->send($request);
|
||||
} catch (ResponseTransferException $ex) {
|
||||
throw $ex;
|
||||
} catch (RequestException $ex) {
|
||||
$response = $ex->getResponse();
|
||||
|
||||
|
||||
Reference in new issue
Block a user