Skip to content

Commit

Permalink
tip about aborting request in stream mode
Browse files Browse the repository at this point in the history
Closes #142
  • Loading branch information
floatdrop committed Dec 12, 2015
1 parent f18abf3 commit a7b098f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion readme.md
Expand Up @@ -147,6 +147,13 @@ When in stream mode, you can listen for events:

`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)

`response` event to get the response object of the final request.
Expand All @@ -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.


#### got.get(url, [options], [callback])
#### got.post(url, [options], [callback])
#### got.put(url, [options], [callback])
Expand Down

0 comments on commit a7b098f

Please sign in to comment.