You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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#L112
So 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:
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 fetchData() request returns null when there's an error is to allow handling in your templates on what to do when there's no data. If you executed this call in your templates, and there's an error, you can do:
I suppose we could change that to add an error property if there was an error, but that'd be a breaking change and would probably trip up a few people who would expect certain values to be present if the above data exists.
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 error key.
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: