@@ -17,16 +17,17 @@ Interesting events emitted by Request:
1717
1818* ` response ` : The response headers were received from the server and successfully
1919 parsed. The first argument is a Response instance.
20- * ` error ` : An error occured .
21- * ` end ` : The request is finished. If an error occured , it is passed as first
20+ * ` error ` : An error occurred .
21+ * ` end ` : The request is finished. If an error occurred , it is passed as first
2222 argument. Second and third arguments are the Response and the Request.
2323
2424Interesting events emitted by Response:
2525
26- * ` data ` : Passes a chunk of the response body as first argument
27- * ` error ` : An error occured.
26+ * ` data ` : Passes a chunk of the response body as first argument and a Response
27+ object itself as second argument.
28+ * ` error ` : An error occurred.
2829* ` end ` : The response has been fully received. If an error
29- occured , it is passed as first argument
30+ occurred , it is passed as first argument.
3031
3132### Example
3233
@@ -43,7 +44,7 @@ $client = $factory->create($loop, $dnsResolver);
4344
4445$request = $client->request('GET', 'https://github.com/');
4546$request->on('response', function ($response) {
46- $response->on('data', function ($data) {
47+ $response->on('data', function ($data, $response ) {
4748 // ...
4849 });
4950});
0 commit comments