Skip to content

Commit 9969b67

Browse files
committed
Update README
1 parent f7d45c5 commit 9969b67

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ $http->on('error', function (Exception $e) {
103103
});
104104
```
105105

106+
An `error` event will be emitted for the `Request` if the validation of the body data fails.
107+
This can be e.g. invalid chunked decoded data or an unexpected `end` event.
108+
109+
```php
110+
$http->on('request', function (Request $request, Response $response) {
111+
$request->on('error', function (\Exception $error) {
112+
echo $error->getMessage();
113+
});
114+
});
115+
```
116+
117+
Such an error will `pause` the connection instead of closing it. A response message
118+
can still be sent.
119+
106120
### Request
107121

108122
The `Request` class is responsible for streaming the incoming request body

0 commit comments

Comments
 (0)