axios: allow transformRequest to take a list

This commit is contained in:
Denis Sokolov 2015-10-02 13:20:24 +03:00
parent 98d3168c2c
commit b84e715a3b
2 changed files with 11 additions and 1 deletions

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
]
});

2
axios/axios.d.ts vendored
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