title: Cannot set http POST headers in desired format (using libcurl)
body: <p>I am working on a REST client which uses libcurl to send HTTP POST Messages.</p>
  
  <p>After receiving HTTP POST packet, My REST server needs to take some action, but it is unable to do that because some headers differ from the expected format.</p>
  
  <p>Required HTTP Packet Format:</p>
  
  <pre><code>Hypertext Transfer Protocol
  &gt; Accept: text/html
  &gt; Content-Type: text/plain 
  
  Line-based text data: text/plain
  &gt;test string
  </code></pre>
  
  <p>Current HTTP Packet Format:</p>
  
  <pre><code>Hypertext Transfer Protocol
  &gt; Accept: */*
  &gt; Content-Type: application/x-www-form-urlencoded
  
  Line-based text data: application/x-www-form-urlencoded
  &gt;test string
  </code></pre>
  
  <p>I have tried the following: (Reference: <a href="http://curl.haxx.se/libcurl/c/httpcustomheader.html" rel="nofollow">http://curl.haxx.se/libcurl/c/httpcustomheader.html</a>)</p>
  
  <pre><code>curl = curl_easy_init();
  if(curl) 
  {
      struct curl_slist *chunk = NULL;
  
  
      /* Add a custom header */ 
      chunk = curl_slist_append(chunk, "Accept: text/html");
      chunk = curl_slist_append(chunk, "Content-Type: text/plain");
  
      /* set our custom set of headers */ 
      curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
  
      res = curl_easy_perform(curl);
  </code></pre>
  
  <p>But this code change has NO EFFECT on the outgoing HTTP POST packet.</p>
  
  <p>Can anyone please suggest me what libcurl options can help me achieve the desired format?</p>
  
  <p>Thanks</p>