Skip to content

Commit

Permalink
Added message to error
Browse files Browse the repository at this point in the history
  • Loading branch information
mcustiel committed Aug 8, 2017
1 parent 4dca6b4 commit 13aef26
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Server/Http/Implementation/ReactPhpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,14 @@ private function createRequestManager(ServerRequestInterface $request)
$bodyStream .= $data;
});
$request->getBody()->on('end', function () use ($resolve, $request, &$bodyStream) {
/** @var ServerRequestInterface $request */
$response = $this->onRequest($request->withBody(new StringStream($bodyStream)));
$resolve($response);
});
// an error occures e.g. on invalid chunked encoded data or an unexpected 'end' event
$request->getBody()->on('error', function (\Exception $exception) use ($resolve) {
$response = new ReactResponse(
400,
['Content-Type' => 'text/plain'],
'An error occured while reading: '
'An error occured while reading: ' . $exception->getMessage()
);
$resolve($response);
});
Expand Down

0 comments on commit 13aef26

Please sign in to comment.