title: Retrofit Android + Spring Boot Server images uploading return Bad Request error
body: <p>I read a lot issues with that here, but it's not working for me. May be I doing something wrong?</p>
  <p>my retrofit Interface:</p>
  <pre><code>@Multipart
  @POST(&quot;/api/v1/services/add&quot;)
  suspend fun addServiceAsync(@Part(&quot;newService&quot;) service: ServiceApiData,
                              @Part imageFile:MultipartBody.Part?,
                              @Header(&quot;Authorization&quot;) jwt:String?): StatusAndStrApi?
  </code></pre>
  <p>And Spring RestController part is</p>
  <pre><code>@PostMapping(&quot;/add&quot;)
  ResponseEntity&lt;?&gt; addService(@RequestPart(name = &quot;newService&quot;) ServiceServer service,
                               @RequestPart(&quot;imageFileFromClient&quot;) MultipartFile imageFile
                               )
  </code></pre>
  <p>Here how i create Multipatr.Body:</p>
  <pre><code>MultipartBody.Part.createFormData(
              &quot;imageFileFromClient&quot;,
              fileImage.name,
              fileImage.asRequestBody(&quot;image/*&quot;.toMediaTypeOrNull()
          )
  </code></pre>
  <p>Here what server return me:</p>
  <pre><code>I/okhttp.OkHttpClient: &lt;-- 400 http://server:8080/api/v1/services/add (301ms)
      X-Content-Type-Options: nosniff
      X-XSS-Protection: 1; mode=block
  I/okhttp.OkHttpClient: Cache-Control: no-cache, no-store, max-age=0, must-revalidate
      Pragma: no-cache
      Expires: 0
      X-Frame-Options: DENY
      Content-Type: application/json
  I/okhttp.OkHttpClient: Transfer-Encoding: chunked
      Date: Fri, 03 Sep 2021 05:11:18 GMT
      Connection: close
      {&quot;timestamp&quot;:&quot;2021-09-03T05:11:18.689+00:00&quot;,&quot;status&quot;:400,&quot;error&quot;:&quot;Bad Request&quot;,&quot;path&quot;:&quot;/api/v1/services/add&quot;}
  I/okhttp.OkHttpClient: &lt;-- END HTTP (110-byte body)
  I/System.out: close [socket][/100.107.22.171:34172]
  </code></pre>