Open dantleech opened 9 years ago
I'm not sure this is a good idea. It means that the body being displayed is not the response body anymore. and it could cause weird issues in case your app is buggy and does not return valid JSON, making things very hard to debug.
Well, if the JSON is invalid it should revert to the original $body. For me this helped alot with debugging, but your call, if you want to close this it's fine.
no it won't. You don't validate the decoding of the JSON. So if decoding fails, you will reencode null
, which is totally valid (it gives you $formattedJson = 'null';
)
Hmm, yeah, I didn't read the code properly. But it could validate the JSON. :)
This PR will pretty print json when
print response
is invoked and theContent-Type
isapplication/json
Will add a feature/test if this is OK.