jason328 jason328 - 3 months ago 66
AngularJS Question

What is the default transformResponse and transformRequest functions in $http

I'm wanting to serialize incoming and outgoing params. I've discovered I can do so by changing

transformRequest
and
transformResponse
default methods in
$http
config. My question is this. What is the default code inside these two functions? For the life of me I can't find out where it's at. In order for me to successfully serialize the params, I need to know what the original functions looked like. I'm currently running Angular 1.5.X. Thanks.

angular.module('coolApp')
.config(function ($httpProvider) {
$httpProvider.defaults.transformRequest = function(data){
// What is the default code here?
}

$httpProvider.defaults.transformResponse = function(data){
// What is the default code here?
}
});

Answer

Default transformRequest and transformResponse functions are defined in $http provider source code.

Comments