title: Is there a way to set Content-type in multipart request with set_form method?
body: <p>I need to set <code>Content-type = "application/pdf"</code> to a parameter of a request with the method "set_form" from net/http class but it always shows me Content-Type = "application/octet-stream".</p>
  
  <p>I already checked out the <a href="https://ruby-doc.org/stdlib-2.6.4/libdoc/net/http/rdoc/Net/HTTPHeader.html#method-i-set_form" rel="nofollow noreferrer">documentation for set_form</a> but I don't know how to properly set the Content-Type.</p>
  
  <pre><code>    http = Net::HTTP.new(uri.host, uri.port)
      request = Net::HTTP::Post.new("#{path}")
      request.set_form([
          ["parameter1","#{parameter1}"],
          ["parameter2","#{parameter2}"],
          ["attachment", File.new("/home/name.pdf", "rb")]
      ], 'multipart/form-data')
      response = http.request(request)
  </code></pre>
  
  <p>I have tried this code to set opt hash like documentation but I have received the same response:</p>
  
  <pre><code>uri = URI.parse("#{host}")
      http = Net::HTTP.new(uri.host, uri.port)
      request = Net::HTTP::Post.new("#{path}")
      request.set_form([
          ["parameter1","#{parameter1}"],
          ["parameter2","#{parameter2}"],
          ["attachment", File.new("/home/name.pdf", "rb"), { "Content-Type" =&gt; "application/pdf" }]
      ], 'multipart/form-data')
      response = http.request(request)
  </code></pre>
  
  <p>The actual output is still <code>Content-Type: application/octet-stream</code> but I need:</p>
  
  <pre><code>... Content-Disposition: form-data; name=\"attachment\"; filename=\"name.pdf\"\r\nContent-Type: application/pdf\r\n\r\n%PDF-1.5\r%\xE2\xE ...
  </code></pre>