Retrofit 2 Multipart POST request sends extra quotes to PHP

后端 未结 4 1839
广开言路
广开言路 2021-02-05 17:08

Using Retrofit 2.0.1, there is a call function in my API interface defined in Android App:

@Multipart
@POST(\"api.php\")
Call doAPI(
  @Part(         


        
4条回答
  •  走了就别回头了
    2021-02-05 17:34

    For your issue, please use as the documentation

    Scalars (primitives, boxed, and String): com.squareup.retrofit2:converter-scalars

    So, add compile 'com.squareup.retrofit2:converter-scalars:2.0.1' into build.gradle file

    Then...

    Retrofit retrofit = new Retrofit.Builder()
        .baseUrl(API_URL_BASE)
        .addConverterFactory(ScalarsConverterFactory.create())
        //.addConverterFactory(GsonConverterFactory.create())
        .build();
    

    Hope it helps!

提交回复
热议问题