Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting request headers and http params for a single request #538

Closed
joshikeerti opened this issue Jan 22, 2014 · 1 comment
Closed

setting request headers and http params for a single request #538

joshikeerti opened this issue Jan 22, 2014 · 1 comment
Labels

Comments

@joshikeerti
Copy link

Hi,
I am trying to use restangular for file upload post request , I want to achieve the same functionality as below in restangular.
However, I was unsure how to set content type and transformRequest for just this particular request. If I understand correctly, setDefaultHeader sets it for all subsequent requests. Is there some other way?
myApp.service('$fileUpload', ['$http', function ($http) {
this.uploadFileToUrl = function(file, uploadUrl){
var filedata = new FormData();
filedata.append('file', file);
$http.post(uploadUrl, filedata, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
})
.success(function(){
})
.error(function(){
});
}
}]);

@mgonto
Copy link
Owner

mgonto commented Jan 22, 2014

Hey,

#420 (comment) would do exactly what you need.

Cheers

@mgonto mgonto closed this as completed Jan 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants