diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts index 93787cf3d7..3f692307a4 100644 --- a/axios/axios-tests.ts +++ b/axios/axios-tests.ts @@ -16,3 +16,13 @@ axios({ 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 + ] +}); diff --git a/axios/axios.d.ts b/axios/axios.d.ts index c2a2873eac..48f57a73a3 100644 --- a/axios/axios.d.ts +++ b/axios/axios.d.ts @@ -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?: (data:T) => U; + transformRequest?: ((data:T) => U)|[(data:T) => U]; /** * change the response data to be made before it is passed to then/catch