title: Multipart/form-data upload by PUT request, doesn't work on okhttp?
body: <p>I don't know it is bug, or I am doing something wrong.</p>
  
  <p>Here is my <code>okhttp</code> request:</p>
  
  <pre><code>private static final MediaType MEDIA_TYPE_JPEG = MediaType.parse("image/jpeg");
  
  protected void putImage(String path) throws IOException {
      RequestBody requestBody = new MultipartBuilder()
          .type(MultipartBuilder.FORM)
          .addPart(
              Headers.of("Content-Disposition", "form-data; name=\"image\""),
              RequestBody.create(MEDIA_TYPE_JPEG, new File(path)))
          .build();
      Request request = new Request.Builder()
          .url("http://localhost:9090/")
          .put(requestBody)
          .build();
      Timber.d(request.urlString());
      okHttpClient.newCall(request).enqueue(new Callback() {
         @Override public void onFailure(Request request, IOException e) {
             e.printStackTrace();
         }
  
         @Override public void onResponse(Response response) throws IOException {
             Timber.d(response.body().string());
         }
      });
  }
  </code></pre>
  
  <p>It gives error with at <a href="https://github.com/kamoljan/sushiobrol/blob/master/api/put.go#L56" rel="nofollow noreferrer">the backend code</a>:</p>
  
  <p>I thought it just backend code has a bug, however, It works on <code>curl</code>:</p>
  
  <pre><code>curl -v -XPUT -include --form asdfasdf=@Photo_20140806_000942.jpg http://localhost:9090/
  </code></pre>
  
  <p>My questions:</p>
  
  <ol>
  <li>Is <code>putImage</code> correct and align with <code>okhttp</code>?</li>
  <li>Is my <code>curl</code> command works very intelligently that make it works?</li>
  <li>Or <code>okhttp</code> does extra things that my backend code should handle?</li>
  </ol>