Sam Anthony
Sam Anthony

Reputation: 1749

Guzzle Exceptions and "http_errors request option"

In the guzzle6 manual (http://guzzle.readthedocs.org/en/latest/quickstart.html#exceptions) it states

A GuzzleHttp\Exception\ClientException is thrown for 400 level errors if the http_errors request option is set to true

What is this "http_errors" setting, how do you change it?

I have tried:

$client = new \Guzzle\Http\Client();
$client->setDefaultOption('http_errors', false);

I am not sure if that had any effect. In addition to this, I can not find the string "http_errors" anywhere in the libraries source code which is making me suspect I am misunderstanding the documentation.

So how do I change this "http_errors" setting/request option?

Upvotes: 2

Views: 7944

Answers (2)

Sam Anthony
Sam Anthony

Reputation: 1749

For Guzzle 6

 $client->get('/status/500', ['http_errors' => false]);

https://guzzle.readthedocs.io/en/latest/request-options.html#http-errors

This answer was provided by @Alcalyn in the comment above.

Upvotes: 6

Rémy
Rémy

Reputation: 1

You need to use "exception" option.

More information here : http://guzzle.readthedocs.org/en/5.3/clients.html#exceptions

Upvotes: 0

Related Questions