提交 a090b052 编写于 作者: M Matt Zabriskie

Merge pull request #136 from nickuraltsev/update-docs

Update README.md: instantiation
......@@ -132,9 +132,34 @@ Helper functions for dealing with concurrent requests.
##### axios.all(iterable)
##### axios.spread(callback)
### Creating an instance
You can create a new instance of axios with a custom config.
##### axios.create([config])
```js
var instance = axios.create({
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
```
### Instance methods
The available instance methods are listed below. The specified config will be merged with the instance config.
##### axios#request(config)
##### axios#get(url[, config])
##### axios#delete(url[, config])
##### axios#head(url[, config])
##### axios#post(url[, data[, config]])
##### axios#put(url[, data[, config]])
##### axios#patch(url[, data[, config]])
## Request API
This is the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
```js
{
......@@ -269,6 +294,13 @@ var myInterceptor = axios.interceptors.request.use(function () {/*...*/});
axios.interceptors.request.eject(myInterceptor);
```
You can add interceptors to a custom instance of axios.
```js
var instance = axios.create();
instance.interceptors.request.use(function () {/*...*/});
```
## Handling Errors
```js
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册