title: How to solve multipart/form-data request in unirest java?
body: <p>I am trying to create attachment in <a href="https://www.openproject.org/" rel="nofollow noreferrer">OpenProject</a> through Unirest java and OpenProject API. I am getting an warning</p>
  
  <pre><code>Jun 05, 2019 10:35:30 AM
  org.apache.http.client.protocol.ResponseProcessCookies processCookies
  WARNING: Invalid cookie header: "Set-Cookie: Expires=Wed, 12 Jun 2019 04:58:08 GMT; Path=/". Invalid 'expires' attribute: Wed, 12 Jun 2019 04:58:08 GMT
  jsonResponse : 400
  </code></pre>
  
  <p>For this code,</p>
  
  <pre><code>HttpResponse&lt;JsonNode&gt; jsonResponse = Unirest.post(url).basicAuth("key","password")
           .header("Content-Type", "multipart/form-data")
           .header("accept", "application/json")
           .field("file", new File("abc.txt"))
           .asJson();
  System.out.println("jsonResponse : "+jsonResponse.getStatus());
  Unirest.shutdown();
  </code></pre>
  
  <p>In API it is provided that the request must be as follows:</p>
  
  <pre><code>Headers
  Content-Type: multipart/form-data
  </code></pre>
  
  <pre><code>Body of request
  --boundary-delimiter
  Content-Disposition: form-data; name="metadata"
  Content-Type: application/json; charset=UTF-8
  
  {
    "fileName": "cute-cat.png",
    "description": {
      "raw": "A cute kitty, cuddling with its friends!"
    }
  }
  
  --boundary-delimiter
  Content-Disposition: form-data; name="file"; filename="attachment"
  Content-Type: image/png
  
  PNG file data
  --boundary-delimiter--
  </code></pre>
  
  <p>The required output is:</p>
  
  <p><strong><em>Response code:200</em></strong></p>
  
  <pre><code>(Response)Header
  Content-Type: application/hal+json
  (Response)Body
  {
      "_type": "Attachment",
      "_links": {
          "self": {
              "href": "/api/v3/attachments/1"
          },
          "container" {
              "href": "/api/v3/work_packages/1"
          },
          "author": {
              "href": "/api/v3/users/1"
          },
          "staticDownloadLocation": {
              "href": "/api/v3/attachments/1/download"
          }
          "downloadLocation": {
              "href": "/some/remote/aws/url/image.png"
          }
      },
      "id": 1,
      "fileName": "cat.png",
      "filesize": 24,
      "description": {
          "format": "plain",
          "raw": "A picture of a cute cat",
          "html": "&lt;p&gt;A picture of a cute cat&lt;/p&gt;"
      },
      "contentType": "image/png",
      "digest": {
          "algorithm": "md5",
          "64c26a8403cd796ea4cf913cda2ee4a9":
      },
      "createdAt": "2014-05-21T08:51:20Z"
  }
  </code></pre>
  
  <p>(This is my first question, so tell me if I do mistake in formatting question)</p>
  
  <p>Thank You!!</p>