```js
var CancelToken = axios.CancelToken;
var source = CancelToken.source();
axios.get('/user/12345', {cancelToken: source.token}).catch(function(thrown){if(axios.isCancel(thrown)) {console.log('Request canceled', thrown.message); }else{// handle error}});// cancel the request (the message parameter is optional)
source.cancel('Operation canceled by the user.');
```