echo $res->getStatusCode();
This did not work for me. Had an array as response, coming form service descriptor configuration. Therefore, I used the location statusCode to retrieve what was needed.
echo $res->getStatusCode();
This did not work for me. Had an array as response, coming form service descriptor configuration. Therefore, I used the location statusCode to retrieve what was needed.
$res = $client->get('/status/500', ['exceptions' => false]);
Make sure Guzzle does not throw exceptions !!! Deal with them by yourself !!!
statusCode
use this location to retrieve message status code when you do not let Guzzle throw exceptions. Something like
"properties": { "httpStatus": { "location": "statusCode", "type": "string" } ...
Internationalize Your Way to Cleaner Code
What a pretty way to put it !
Make the Magic go away.
Clever indeed...
if the client is incapable of working with HTTP headers
OK... So in fact the wrapper I am implementing for recs ecommerce API is overkill - it is redundant with http. I'll keep it though, since I like to define my own error codes.
I'm a big fan of the approach that Stripe has taken to API versioning -
Ouch ! :/ I read somewhere else that this was in fact very bad practice...
RFC 7235 - Access Authentication Framework RFC 2617 - HTTP Authentication: Basic and Digest Access Authentication
Further readings...