-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting full response? #10
Comments
There's two types of errors we handle with Consume. First is when the HTTP request reports back a non-2xx request. We then return the error as determined by Guzzle and other HTTP code/message. The second case is when it's returned a 200 HTTP request (it succeeded technically), but there was an error in the API processing. This is the tricky one, as every API handles internal errors differently. Now the reason that a {% set data = consume('fedex', 'POST', 'documents/v1/etds/upload') %}
{% if data %}
// ... I suppose we could change that to add an I've added a new option you can pass into a payload, which Consume will check to determine if you actually want the error response. This will be returned in an {% set data = consume('fedex', 'POST', 'invalid/endpoint', {
includeErrorResponse: true,
}) %} If this instance, you'll get:
So you'll be able to check for |
@engram-design thanks so much for the explanation and the fix, looks perfect! |
Question
Hello, is there a way to get the full guzzle response, for example if I run this query
$data = Consume::$plugin->getService()->fetchData('fedexTradeUpload', 'POST', 'documents/v1/etds/upload', $payload);
$data returns
null
but if I drill down into Guzzle i manage to get this:
by adding a debug on
$response->getBody()->getContents()
on this line https://github.com/guzzle/guzzle/blob/2779e868a00289e1b1fd854af030c43a06f4bcb4/src/Exception/RequestException.php#L112So it's useful info I want to get somehow but it's not getting back all the way up the chain.
Thank you!
Additional context
No response
The text was updated successfully, but these errors were encountered: