Closed radutopala closed 6 years ago
Thanks! That's weird, I'm using POST requests on another project and that worked fine. I will do additional tests.
Oh wait maybe I should do parse_str
only for specific POST requests. E.g. if it's a POST request but JSON is sent then you don't want the body to be parsed. I think that may be it.
Yeah, that should be it. I sent the json directly in the body.
The approach of Zend Expressive is interesting, they have a middleware that will apply the correct "strategy" of decoding the body based on the header: https://github.com/zendframework/zend-expressive-helpers/blob/master/src/BodyParams/BodyParamsMiddleware.php The downside is that it's a middleware, and JSON decoding is not really something that PHP does natively. I don't want this package to do more than what PHP does natively, frameworks already deal with JSON.
Slim's approach in it's base PSR-7 implementation is simpler:
Slim's implementation looks natural and straightforward indeed.
@mnapoli I could only use the httpHandler after applying this patch, else
$request
was containing a gibberish array.. maybe it's only me..Try with any of the json from https://apex.sh/docs/ping/webhooks/.
Else, thanks for this wrapper 😄