我想问一个关于在 Kotlin 中使用 Retrofit 2 POST 的问题
这是 Postman 所做的输入
"assets": {
"product": [
{
"eTag": "\"a59d9f11f3bfc643b00a96cabb8127a6\"",
"location": "https---abc.com/abc.png",
"filename": "abc",
"type": "PD"
},
{
"eTag": "\"dd74783c22bdb8c7cf5ff0185297ee06\"",
"location": "https---abc.com/abc.png",
"filename": "abc",
"type": "PD"
}
],
"barcode": [
{
"eTag": "\"3a4a0719d5fb9f5a1e4b6b9d246db4de\"",
"location": "https---abc.com/abc.png",
"filename": "abc",
"type": "BC"
}
]
}
这是来自我的界面
@FormUrlEncoded
@POST("create/newassets")
fun newAssets(
@Field("assets") assets: Asset? = null,
): Call<NewSkuResponse>
这是来自我的班级资产
data class Asset(
@field:SerializedName("product")
var product: MutableList<DataItemAsset?>,
@field:SerializedName("barcode")
var barcode: MutableList<DataItemAsset?>
)
我收到了 400 个错误请求,我认为我的代码无法正常工作,有任何帮助,谢谢