title: Retrofit 2.0 Multipart Request, send boolean type in form data including file
body: <p>I am trying to upload a file using retrofit 2.0. Apart from file, I have few other params to be send with form data which include a boolean type also. My request declaration is - </p>
  
  <pre><code>@Multipart
      @POST("/upload/abc")
      Call&lt;UploadResponse&gt; uploadToServer(@Part("img_file\";filename=\"image") RequestBody file,
                                               @Part("access_token") RequestBody sessionKey,
                                               @Part("is_final") Boolean isFinal,
                                               @Part("sequence_id") Integer sequenceId,
                                               @Part("entity_id") RequestBody entityId,
                                               @Part("image_type") RequestBody imageType);
  </code></pre>
  
  <p>I am using GsonConverterFactory. I tried 2 approaches - </p>
  
  <p>(1) Instead of <code>@Part("is_final") Boolean isFinal</code> I used <code>@Part("is_final") RequestBody isFinal</code> and sending it with <code>RequestBody.create(MediaType.parse("text/plain"), String.valueOf(true))</code></p>
  
  <p>(2) Using <code>@Part("is_final") Boolean isFinal</code> and sending with Boolean.true.</p>
  
  <p>In both the cases, "is_final" received on server side is Unicode or as a String instead of boolean value. </p>
  
  <p>What is the best way to achieve this</p>