Merge pull request #6099 from Dashlane/axios-transform-request

axios: allow transformRequest to take a list
This commit is contained in:
Masahiro Wakame
2015-10-06 21:34:48 +09:00
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -16,3 +16,13 @@ axios<Repository>({
method: HttpMethod[HttpMethod.GET],
headers: {},
}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name));
axios.post("http://example.com/", {}, {
transformRequest: (data: any) => data
});
axios.post("http://example.com/", {}, {
transformRequest: [
(data: any) => data
]
});
+1 -1
View File
@@ -17,7 +17,7 @@ declare module Axios {
* This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
* The last function in the array must return a string or an ArrayBuffer
*/
transformRequest?: <U>(data:T) => U;
transformRequest?: (<U>(data:T) => U)|[<U>(data:T) => U];
/**
* change the response data to be made before it is passed to then/catch