Monday, 12 August 2013

Multipart request does not work

Multipart request does not work

This is what I currently have, put together by different blogs trying to
describe how to do a multipart request in Angular. However, it does not
work. It says Bad request (400). What is wrong? Is it because it miss the
content-type beneath the Content-Disposition header? How do I add that if
that is the case?
I will add 100 points for quick answer! As soon I am allowed to do so.
var fd = new FormData();
fd.append('data', server);
return $http.post('/servers', fd, {
transformRequest: angular.identity,
headers: {
'Content-Type': undefined
}
});
Request payload from Chrome
------WebKitFormBoundaryoWOUGkw6GayCLwSB
Content-Disposition: form-data; name="data"
{"status":"REJECTED","description":"Test"}
------WebKitFormBoundaryoWOUGkw6GayCLwSB--

No comments:

Post a Comment