Skip to content

Instantly share code, notes, and snippets.

@lordnox
Created April 15, 2015 13:36
Show Gist options
  • Save lordnox/e103216425de6686dc78 to your computer and use it in GitHub Desktop.
Save lordnox/e103216425de6686dc78 to your computer and use it in GitHub Desktop.
{
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