Uh oh!
There was an error while loading. Please reload this page.
Request::getBody(), see #57 - #58
Conversation
There was a problem hiding this comment.
IMHO rawbody should return rawbody, not parsed body
There was a problem hiding this comment.
? This commit does not change getRawBody() result.
There was a problem hiding this comment.
You're using the same callback, that also parses the JSON for application/json, aren't you?
There was a problem hiding this comment.
Oh, you've added new parameter, sorry :)
Majkl578
commented
Feb 27, 2015
Although it's a nice closure magic, I'm afraid it's gonna be slow, it's not even lazy... I mean, those unnecessary body calls could be easily avoided if type check was extracted outside (like |
JanTvrdik
commented
Feb 27, 2015
@Majkl578 That's how I originally wanted to do it, but then I though that it is not powerful enough. What if you want to make decision based on something different than Content-Type (e.g. HTTP method)? What if you want to handle all something/* types? That being said I like the simple solution |
|
1dc599c to
f35d20fComparef73e5f9 to
48409afCompareJanTvrdik
commented
Jun 5, 2016
I think that this is now ready to merge. |
| * @throws InvalidRequestBodyException | ||
| */ | ||
| public function getBody() | ||
| { |
@JanTvrdik What about the JSON decode DOS vulnerability? I didn't see anything that would solve it in your code (but I might have missed it of course). |
@enumag I ignore it the same way everybody in the PHP worlds ignores it. Those few that are concern may replace the body parser for JSON with sth smarter. |
JanTvrdik
commented
Jun 5, 2016
BTW: PSR7 calls this method |
| if ($body === NULL) { | ||
| $contentType = $request->getHeader('Content-Type'); | ||
| foreach ($this->bodyParsers as $parserContentType => $parser) { | ||
| if (stripos($contentType, $parserContentType) === 0) { |
There was a problem hiding this comment.
Yes. Its PHP shame that there is no startsWith function.
a00de7a to
4210d9eCompare7f12fde to
9791354Compare51f373c to
69af026Compare87fefb5 to
9590f91Compare56c2641 to
544d9e6Compare0ac6562 to
4493f9bCompare
No description provided.