mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Merge pull request #407 from axelboc/patch-2
Fixing doc on accessing response with then/catch
This commit is contained in:
@@ -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
|
```js
|
||||||
axios.get('/user/12345')
|
axios.get('/user/12345')
|
||||||
@@ -332,9 +332,11 @@ axios.get('/user/12345')
|
|||||||
console.log(response.statusText);
|
console.log(response.statusText);
|
||||||
console.log(response.headers);
|
console.log(response.headers);
|
||||||
console.log(response.config);
|
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
|
## Config Defaults
|
||||||
|
|
||||||
You can specify config defaults that will be applied to every request.
|
You can specify config defaults that will be applied to every request.
|
||||||
|
|||||||
Reference in New Issue
Block a user