2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Add 'progress' config option for monitoring progress events for uploads and downloads.

This commit is contained in:
Davis Barber
2015-07-30 13:54:53 -04:00
parent 8c1694e821
commit 261e41644d
3 changed files with 28 additions and 7 deletions
+11 -5
View File
@@ -49,7 +49,7 @@ axios.get('/user?ID=12345')
.catch(function (response) {
console.log(response);
});
// Optionally the request above could also be done as
axios.get('/user', {
params: {
@@ -147,7 +147,7 @@ This is the available config options for making requests. Only the `url` is requ
// The last function in the array must return a string or an ArrayBuffer
transformRequest: [function (data) {
// Do whatever you want to transform the data
return data;
}],
@@ -155,7 +155,7 @@ This is the available config options for making requests. Only the `url` is requ
// it is passed to then/catch
transformResponse: [function (data) {
// Do whatever you want to transform the data
return data;
}],
@@ -186,7 +186,13 @@ This is the available config options for making requests. Only the `url` is requ
xsrfCookieName: 'XSRF-TOKEN', // default
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value
xsrfHeaderName: 'X-XSRF-TOKEN' // default
xsrfHeaderName: 'X-XSRF-TOKEN', // default
// `progress` allows handling of progress events for 'POST' and 'PUT uploads'
// as well as 'GET' downloads
progress: function(progressEvent) {
// Do whatever you want with the native progress event
}
}
```
@@ -201,7 +207,7 @@ The response for a request contains the following information.
// `status` is the HTTP status code from the server response
status: 200,
// `statusText` is the HTTP status message from the server response
statusText: 'OK',