title: POST request with Multipart/form-data. Content-type not correct
body: <p>We're trying to write a script with python (using python-requests a.t.m.) to do a POST request to a site where the content has to be MultipartFormData. 
  When we do this POST request manually (by filling in the form on the site and post), using wireshark, this came up (short version):</p>
  
  <pre><code>Content-Type: multipart/form-data;
  Content-Disposition: form-data; name="name"
  Data (8 Bytes)
      John Doe
  </code></pre>
  
  <p>When we try to use the python-requests library for achieving the same result, this is sent:</p>
  
  <pre><code>Content-Type: application/x-pandoplugin
  Content-Disposition: form-data; name="name"; filename="name"\r\n
  Media type: application/x-pandoplugin (12 Bytes)
      //and then in this piece is what we posted://
      John Doe
  </code></pre>
  
  <p>The weird thing is that the 'general type' of the packet indeed is multipart/form-data, but the individual item sent (key = 'name', value= 'John Doe') has type application/x-pandoplugin (a random application on my pc I guess).</p>
  
  <p>This is the code used:</p>
  
  <pre><code>response = s.post('http://url.com', files={'name': 'John Doe'})
  </code></pre>
  
  <p>Is there a way to specify the content-type of the individual items instead of using the headers argument (which only changes the type of the 'whole' packet)?</p>
  
  <p>We think the server doesn't respond correctly due to the fact that it can't understand the content-type we send it.</p>
  
  <p><strong>Little update:</strong>
  I think the different parts of the multipart content are now identical to the ones sent if I do the POST in the browser, so that's good. Still the server doesn't actually do the changes I send it with the script. The only thing that still is different is the order of the different parts. </p>
  
  <p>For example this is what my browser sends: </p>
  
  <pre><code>Boundary: \r\n------WebKitFormBoundary3eXDYO1lG8Pgxjwj\r\n
  Encapsulated multipart part:  (text/plain)
      Content-Disposition: form-data; name="file"; filename="ex.txt"\r\n
      Content-Type: text/plain\r\n\r\n
      Line-based text data: text/plain
          lore ipsum blabbla
  
  Boundary: \r\n------WebKitFormBoundary3eXDYO1lG8Pgxjwj\r\n
  Encapsulated multipart part: 
      Content-Disposition: form-data; name="seq"\r\n\r\n
      Data (2 bytes)
  
  Boundary: \r\n------WebKitFormBoundary3eXDYO1lG8Pgxjwj\r\n
  Encapsulated multipart part: 
      Content-Disposition: form-data; name="name"\r\n\r\n
      Data (2 bytes)
  </code></pre>
  
  <p>And this is what the script (using python-requests) sends:</p>
  
  <pre><code>Boundary: \r\n------WebKitFormBoundary3eXDYO1lG8Pgxjwj\r\n
  Encapsulated multipart part: 
      Content-Disposition: form-data; name="name"\r\n\r\n
      Data (2 bytes)
  
  Boundary: \r\n------WebKitFormBoundary3eXDYO1lG8Pgxjwj\r\n
  Encapsulated multipart part:  (text/plain)
      Content-Disposition: form-data; name="file"; filename="ex.txt"\r\n
      Content-Type: text/plain\r\n\r\n
      Line-based text data: text/plain
          lore ipsum blabbla
  
  Boundary: \r\n------WebKitFormBoundary3eXDYO1lG8Pgxjwj\r\n
  Encapsulated multipart part: 
      Content-Disposition: form-data; name="seq"\r\n\r\n
      Data (2 bytes)
  </code></pre>
  
  <p>Could it be possible that the server counts on the order of the parts? According to <a href="https://stackoverflow.com/questions/7449861/multipart-upload-form-is-order-guaranteed">Multipart upload form: Is order guaranteed?</a>, it apparently is? And if so, is it possible to explicitly force an order using the requests library?
  And to make things worse in that case: There is a mixture of a file and just text values.</p>
  
  <p>So forcing an order seems rather difficult. This is the current way I do it:</p>
  
  <pre><code>s.post('http://www.url.com', files=files,data = form_values)
  </code></pre>
  
  <p><strong>EDIT2:</strong>
  I did a modification in the requests plugin to make sure the order of the parts is the same as in the original request. This doesn't fix the problem so I guess there is no straightforward solution for my problem. I'll send a mail to the devs of the site and hope they can help me!</p>