Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-2065

Simplify additon of content type parameters in MultipartEntityBuilder

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.2-beta1
    • None
    • None

    Description

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

      I have to do

      MultipartEntityBuilder eb = MultipartEntityBuilder.create();
      eb.setContentType(ContentType.create("multipart/related",
        new BasicNameValuePair("type", "application/json"),
        new BasicNameValuePair("start", String.format("<%s>", moduleJobCid))));
      

      The easier way should be

      MultipartEntityBuilder eb = MultipartEntityBuilder.create();
      eb.setMimeSubtype("related");
      eb.addParameter(new BasicNameValuePair(...));
      eb.addParameter(new BasicNameValuePair(...));
      

      Attachments

        Activity

          People

            michael-o Michael Osipov
            michael-o Michael Osipov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h