@@ -1091,18 +1091,18 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
10911091 public RequestBody serialize (Object obj , String contentType ) throws ApiException {
10921092 if (obj instanceof byte []) {
10931093 // Binary (byte array) body parameter support.
1094- return RequestBody .create (MediaType . parse ( contentType ), ( byte []) obj );
1094+ return RequestBody .create (( byte []) obj , MediaType . parse ( contentType ) );
10951095 } else if (obj instanceof File ) {
10961096 // File body parameter support.
1097- return RequestBody .create (MediaType .parse (contentType ), ( File ) obj );
1097+ return RequestBody .create (( File ) obj , MediaType .parse (contentType ));
10981098 } else if (isJsonMime (contentType )) {
10991099 String content ;
11001100 if (obj != null ) {
11011101 content = json .serialize (obj );
11021102 } else {
11031103 content = null ;
11041104 }
1105- return RequestBody .create (MediaType .parse (contentType ), content );
1105+ return RequestBody .create (content , MediaType .parse (contentType ));
11061106 } else {
11071107 logger .error ("ApiException : Content type \" " + contentType + "\" is not supported" );
11081108 throw new ApiException ("Content type \" " + contentType + "\" is not supported" );
@@ -1516,7 +1516,7 @@ private RequestBody createRequestBody(String method, Object body, Map<String, Ob
15161516 reqBody = null ;
15171517 } else {
15181518 // use an empty request body (for POST, PUT and PATCH)
1519- reqBody = RequestBody .create (MediaType .parse (contentType ), "" );
1519+ reqBody = RequestBody .create ("" , MediaType .parse (contentType ));
15201520 }
15211521 } else {
15221522 if (body .equals ("{}" )) {
@@ -1636,10 +1636,10 @@ public RequestBody buildRequestBodyMultipart(Map<String, Object> formParams) {
16361636 Headers partHeaders = Headers .of ("Content-Disposition" ,
16371637 "form-data; name=\" " + param .getKey () + "\" ; filename=\" " + file .getName () + "\" " );
16381638 MediaType mediaType = MediaType .parse (guessContentTypeFromFile (file ));
1639- mpBuilder .addPart (partHeaders , RequestBody .create (mediaType , file ));
1639+ mpBuilder .addPart (partHeaders , RequestBody .create (file , mediaType ));
16401640 } else {
16411641 Headers partHeaders = Headers .of ("Content-Disposition" , "form-data; name=\" " + param .getKey () + "\" " );
1642- mpBuilder .addPart (partHeaders , RequestBody .create (null , parameterToString (param .getValue ())));
1642+ mpBuilder .addPart (partHeaders , RequestBody .create (parameterToString (param .getValue ()), null ));
16431643 }
16441644 }
16451645 return mpBuilder .build ();
0 commit comments