2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-24 14:04:14 +03:00

Merge pull request #407 from axelboc/patch-2

Fixing doc on accessing response with then/catch
This commit is contained in:
Matt Zabriskie
2016-08-12 22:16:30 -05:00
committed by GitHub
+4 -2
View File
@@ -322,7 +322,7 @@ The response for a request contains the following information.
}
```
When using `then` or `catch`, you will receive the response as follows:
When using `then`, you will receive the response as follows:
```js
axios.get('/user/12345')
@@ -332,9 +332,11 @@ axios.get('/user/12345')
console.log(response.statusText);
console.log(response.headers);
console.log(response.config);
});
});
```
When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
## Config Defaults
You can specify config defaults that will be applied to every request.