在使用retrofit 以Mutopart 進行表單數據上傳時,後臺收到的數據有雙引號
原因很簡單往往是因爲 你使用了GsonConverterFactory, 這時你需要添加一個標準轉換器 converter-scalars 在其之前 代碼如下
// 標準轉換器,去掉 Retrofit以Mutipart上傳參數時,String參數會多一對雙引號
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
// gson converter
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create());