title: How to POST JSON and a file to web service with Angular?
body: <p>How do I send a POST request with AngularJS? The JSON part is required but the file is not. I have tried this based on other blog posts but it does not work. I get a <em>Bad request 400 error</em>.</p>
  
  <p><strong>200 points to the correct answer will be added</strong></p>
  
  <pre><code>var test = {
    description:"Test",
    status: "REJECTED"
  };
  
  var fd = new FormData();
  fd.append('data', angular.toJson(test));
  
  return $http.post('/servers', fd, {
    transformRequest: angular.identity,
    headers: {
      'Content-Type': undefined
    }
  });
  </code></pre>