mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
Update README.md
This commit is contained in:
@@ -180,18 +180,18 @@ These are the available config options for making requests. Only the `url` is re
|
|||||||
{
|
{
|
||||||
// `url` is the server URL that will be used for the request
|
// `url` is the server URL that will be used for the request
|
||||||
url: '/user',
|
url: '/user',
|
||||||
|
|
||||||
// `method` is the request method to be used when making the request
|
// `method` is the request method to be used when making the request
|
||||||
method: 'get', // default
|
method: 'get', // default
|
||||||
|
|
||||||
// `baseURL` will be prepended to `url` unless `url` is absolute.
|
// `baseURL` will be prepended to `url` unless `url` is absolute.
|
||||||
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
|
||||||
// to methods of that instance.
|
// to methods of that instance.
|
||||||
baseURL: 'https://some-domain.com/api/',
|
baseURL: 'https://some-domain.com/api/',
|
||||||
|
|
||||||
// `transformRequest` allows changes to the request data before it is sent to the server
|
// `transformRequest` allows changes to the request data before it is sent to the server
|
||||||
// This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
// This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||||
// The last function in the array must return a string or an ArrayBuffer
|
// The last function in the array must return a string, an ArrayBuffer, or a Stream
|
||||||
transformRequest: [function (data) {
|
transformRequest: [function (data) {
|
||||||
// Do whatever you want to transform the data
|
// Do whatever you want to transform the data
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ These are the available config options for making requests. Only the `url` is re
|
|||||||
|
|
||||||
// `data` is the data to be sent as the request body
|
// `data` is the data to be sent as the request body
|
||||||
// Only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
// Only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||||
// When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash
|
// When no `transformRequest` is set, must be a string, an ArrayBuffer, a hash, or a Stream
|
||||||
data: {
|
data: {
|
||||||
firstName: 'Fred'
|
firstName: 'Fred'
|
||||||
},
|
},
|
||||||
@@ -250,7 +250,7 @@ These are the available config options for making requests. Only the `url` is re
|
|||||||
}
|
}
|
||||||
|
|
||||||
// `responseType` indicates the type of data that the server will respond with
|
// `responseType` indicates the type of data that the server will respond with
|
||||||
// options are 'arraybuffer', 'blob', 'document', 'json', 'text'
|
// options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'
|
||||||
responseType: 'json', // default
|
responseType: 'json', // default
|
||||||
|
|
||||||
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
|
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
|
||||||
@@ -264,7 +264,7 @@ These are the available config options for making requests. Only the `url` is re
|
|||||||
progress: function(progressEvent) {
|
progress: function(progressEvent) {
|
||||||
// Do whatever you want with the native progress event
|
// Do whatever you want with the native progress event
|
||||||
},
|
},
|
||||||
|
|
||||||
// `maxContentLength` defines the max size of the http response content allowed
|
// `maxContentLength` defines the max size of the http response content allowed
|
||||||
maxContentLength: 2000
|
maxContentLength: 2000
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ instance.defaults.timeout = 2500;
|
|||||||
// Override timeout for this request as it's known to take a long time
|
// Override timeout for this request as it's known to take a long time
|
||||||
instance.get('/longRequest', {
|
instance.get('/longRequest', {
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Interceptors
|
## Interceptors
|
||||||
|
|||||||
Reference in New Issue
Block a user