title: How do I send an Object along with an attached File in a Multipart superagent request?
body: <p>I am trying to make a multipart POST request to my API using superagent.</p>
  
  <p>My Code:</p>
  
  <pre><code>superagent
    .post(apiUrl + '/api/company/profile/edit')
    .field("profileData", profileData)
    .attach('company_logo', logoFile )
    .set('Accept', 'application/json')
    .end(function(err, res){
      if(err){
        dispatch(updateProfileStatusAction("error", res));
      } else {
        dispatch(updateProfileStatusAction("success", res));
      }
    });
  </code></pre>
  
  <p>The problem I am having is that <code>profileData</code> is an object that is nested. When I get the request in the API I see the value of <code>profileData</code> as the string <code>[Object, Object]</code></p>
  
  <p>When I look at the documentation for multipart request with superagent <a href="https://visionmedia.github.io/superagent/#multipart-requests" rel="noreferrer">https://visionmedia.github.io/superagent/#multipart-requests</a> it appears like the <code>.field()</code> is meant to be just a key, value pair rather then an object. I then tried to use .send({profileData: profileData}) instead of field, but when I do that I get an error saying that .attach and .send can not be used together in the same request.</p>