Browse Source

tip about aborting request in stream mode

Closes #142
http2
Vsevolod Strukchinsky 9 years ago
parent
commit
a7b098f9f8
  1. 8
      readme.md

8
readme.md

@ -147,6 +147,13 @@ When in stream mode, you can listen for events:
`request` event to get the request object of the request. `request` event to get the request object of the request.
__Tip__: You can use `request` event to abort request:
```js
got.stream('github.com')
.on('request', req => setTimeout(() => req.abort(), 50));
```
##### .on('response', response) ##### .on('response', response)
`response` event to get the response object of the final request. `response` event to get the response object of the final request.
@ -159,7 +166,6 @@ When in stream mode, you can listen for events:
`error` event emitted in case of protocol error (like `ENOTFOUND` etc.) or status error (4xx or 5xx). The second argument is the body of the server response in case of status error. The third argument is response object. `error` event emitted in case of protocol error (like `ENOTFOUND` etc.) or status error (4xx or 5xx). The second argument is the body of the server response in case of status error. The third argument is response object.
#### got.get(url, [options], [callback]) #### got.get(url, [options], [callback])
#### got.post(url, [options], [callback]) #### got.post(url, [options], [callback])
#### got.put(url, [options], [callback]) #### got.put(url, [options], [callback])

Loading…
Cancel
Save