【发布时间】:2021-03-12 02:36:08
【问题描述】:
我想问一个关于在 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 个错误请求,我认为我的代码不能正常工作 有什么帮助,谢谢
【问题讨论】:
-
应用程序崩溃时得到的错误或输出是什么?
标签: kotlin retrofit2 retrofit2.6