diff --git a/README.md b/README.md index 37cdc6d..3cba598 100644 --- a/README.md +++ b/README.md @@ -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