Created
April 15, 2015 13:36
-
-
Save lordnox/e103216425de6686dc78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
request: function(url, method, data, headers) { | |
var request; | |
if (method == null) { | |
method = "GET"; | |
} | |
request = angular.isObject(url) ? angular.copy(url) : { | |
url: url | |
}; | |
request.method = request.method || method || "GET"; | |
request.data = request.data || data || {}; | |
return $http(api.defaults(request, { | |
headers: Authentication.addToken(request.headers || { | |
"Content-Type": "application/json;chartset=UTF8", | |
"Accept": "application/json" | |
}) | |
})).then(function(response) { | |
return response.data; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment