We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using https://github.com/reactphp/http/tree/cd15204bd15d106d7832c680e4fb0ca0ce2f5e30 I've noticed that I'm no longer receiving post bodies:
➜ vz git:(next) ✗ curl -m 3 -X POST -d '{"data":[{"uuid":"a16e7380-ccf7-11e6-aa5c-1195f3e90cce","tuples":[[1,1,1]]}]}'
This is the code:
function __construct(ReactSocketServer $socket, MiddlewareAdapter $hub) { parent::__construct($socket); $this->hub = $hub; $this->on('request', array($this, 'onRequest')); } /** * main push request/ websocket response loop */ function onRequest(Request $request, Response $response) { $content = ''; $headers = $request->getHeaders(); $contentLength = isset($headers['Content-Length']) ? (int) $headers['Content-Length'] : null; // length required, chunked encoding not supported if (null === $contentLength) { $response->writeHead(411); $response->end(); return; } $request->on('data', function($data) use ($request, $response, &$content, $contentLength) { // read data (may be empty for GET request) $content .= $data; // handle request after receive if (strlen($content) >= $contentLength) { } });
Imho on('request')->on('data') should still work but the inner on is only called once with empty data (string(0) "").
on('request')->on('data')
string(0) ""
Any idea why/where this suddenly fails? Definitely working before...
The text was updated successfully, but these errors were encountered:
Darn. If you use curl make sure to add -H "Content-Type: application/json" or you won't get a post body.
-H "Content-Type: application/json"
Sorry, something went wrong.
No branches or pull requests
Using https://github.com/reactphp/http/tree/cd15204bd15d106d7832c680e4fb0ca0ce2f5e30 I've noticed that I'm no longer receiving post bodies:
This is the code:
Imho
on('request')->on('data')
should still work but the inner on is only called once with empty data (string(0) ""
).Any idea why/where this suddenly fails? Definitely working before...
The text was updated successfully, but these errors were encountered: