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

Merge pull request #1157 from amine26tz/patch-1

patch(requestException): add http method in message of request Exception
This commit is contained in:
Michael Dowling 2015-07-04 11:58:07 -07:00
commit d96cc2cf9b
2 changed files with 4 additions and 3 deletions

View File

@ -90,6 +90,7 @@ class RequestException extends TransferException
}
$message = $label . ' [url] ' . $request->getUri()
. ' [http method] ' . $request->getMethod()
. ' [status code] ' . $response->getStatusCode()
. ' [reason phrase] ' . $response->getReasonPhrase();

View File

@ -32,7 +32,7 @@ class RequestExceptionTest extends \PHPUnit_Framework_TestCase
{
$e = RequestException::create(new Request('GET', '/'), new Response(400));
$this->assertEquals(
'Client error response [url] / [status code] 400 [reason phrase] Bad Request',
'Client error response [url] / [http method] GET [status code] 400 [reason phrase] Bad Request',
$e->getMessage()
);
$this->assertInstanceOf('GuzzleHttp\Exception\ClientException', $e);
@ -42,7 +42,7 @@ class RequestExceptionTest extends \PHPUnit_Framework_TestCase
{
$e = RequestException::create(new Request('GET', '/'), new Response(500));
$this->assertEquals(
'Server error response [url] / [status code] 500 [reason phrase] Internal Server Error',
'Server error response [url] / [http method] GET [status code] 500 [reason phrase] Internal Server Error',
$e->getMessage()
);
$this->assertInstanceOf('GuzzleHttp\Exception\ServerException', $e);
@ -52,7 +52,7 @@ class RequestExceptionTest extends \PHPUnit_Framework_TestCase
{
$e = RequestException::create(new Request('GET', '/'), new Response(600));
$this->assertEquals(
'Unsuccessful response [url] / [status code] 600 [reason phrase] ',
'Unsuccessful response [url] / [http method] GET [status code] 600 [reason phrase] ',
$e->getMessage()
);
$this->assertInstanceOf('GuzzleHttp\Exception\RequestException', $e);