Skip to content
Permalink
Browse files

Don't call getSize()

getSize() can be expensive, instead read the stream and conditionally
assign the input with the stream contents.
  • Loading branch information...
markstory committed Jun 19, 2016
1 parent a8567c5 commit 745aefc46f428af20449a56160e7559a7ab4c210
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/Http/RequestTransformer.php
@@ -48,11 +48,8 @@ public static function toCake(PsrRequest $request)
$post = Hash::merge($post, $files);
}
$input = null;
$stream = $request->getBody();
if ($stream->getSize()) {
$input = $stream->getContents();
}
$input = $request->getBody()->getContents();
$input = $input === '' ? null : $input;
return new CakeRequest([
'query' => $request->getQueryParams(),

0 comments on commit 745aefc

Please sign in to comment.
You can’t perform that action at this time.