Michael Osipov created HTTPCLIENT-2065:
------------------------------------------

             Summary: Simplify additon of content type parameters in 
MultipartEntityBuilder
                 Key: HTTPCLIENT-2065
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2065
             Project: HttpComponents HttpClient
          Issue Type: Improvement
            Reporter: Michael Osipov


Consider I want this content type: {{multipart/related; 
type="application/module-job+json"; 
start="<e8f615d3-5169-42a8-88fe-e5d2a6147db4@lda-client-x>"; 
boundary=jkEwGD2liR4fm3pYCaajTuSi116SUhmmB91VJ2_n}}

I have to do
{code}
MultipartEntityBuilder eb = MultipartEntityBuilder.create();
eb.setContentType(ContentType.create("multipart/related",
  new BasicNameValuePair("type", "application/module-job+json"),
  new BasicNameValuePair("start", String.format("<%s>", moduleJobCid))));
{code}

The easier way should be
{code}
MultipartEntityBuilder eb = MultipartEntityBuilder.create();
eb.setMimeSubtype("related");
eb.addParameter(new BasicNameValuePair(...));
eb.addParameter(new BasicNameValuePair(...));
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to