diff --git a/readme.md b/readme.md index 74d6f66..e4447d3 100644 --- a/readme.md +++ b/readme.md @@ -280,7 +280,21 @@ When given an unsupported protocol. ## Aborting the request -The promise returned by Got has a `.cancel()` function which, when called, aborts the request. +The promise returned by Got has a [`.cancel()`](https://github.com/sindresorhus/p-cancelable) method which, when called, aborts the request. + +```js +const request = got(url, options); + +request.catch(err => { + if (request.canceled) { + // Handle cancelation + } + + // Handle other errors +}); + +request.cancel(); +``` ## Proxies