-
Notifications
You must be signed in to change notification settings - Fork 37
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
json encode (and decode) failing silently #65
Comments
Thanks for raising this issue! This was unfortunately not possible with the v1.x.x range of this library, because it had to support older versions of PHP. |
Hmmz, reading this issue again, I just realized my earlier reply makes no sense. Apologies for that! Version 2.0.0 currently ignores the status code as well, and that works fine in production: postnl-api-php/src/Service/ResponseProcessor/Rest/LabellingServiceRestResponseProcessor.php Lines 67 to 77 in 30034d9
postnl-api-php/src/Service/ResponseProcessor/Rest/AbstractRestResponseProcessor.php Lines 55 to 136 in 30034d9
I don't think I have documented it properly, but these were supposed to be the meaning of every exception:
The |
|
A polyfill has been used to make this work from 1.4.0 on as well. |
I was facing an issue where I encountered "HTTP/1.1 500 Internal Server Error" errors on the PostNL side. Turns out that due to wrong character encoding, json_encode was failing silently, causing an empty body to be sent.
I did a quick check and
JSON_THROW_ON_ERROR
isn't used so far. I don't think there should be any internal error handling for json errors, I think the handling of this is the responsibility of the Application using the library. My previous issue #58 was in fact caused by this as well.There seems to be no explicit error handling for status 500. The response object (when
Unable to generate label
has:The logic in the LabelingService:
Removing the status code check and then just always throwing this would be sufficient if there's no specific edge cases you want to cover here
I can make PR with these changes if you want
The text was updated successfully, but these errors were encountered: