问题描述
我尝试:
newPostDto.images.map {
append("images",it)
}
但它的变体不起作用。
解决方法
这是一个示例(有关详细信息,您可以查看 this repo 以获取完整的图像文件上传示例)
client.submitFormWithBinaryData(
formData {
appendInput(key = ICON_FILE_PART,headers = Headers.build {
append(HttpHeaders.ContentDisposition,"filename=${appId}_ic")
}) {
buildPacket { writeFully(icon.toByteArray()) }
}
}) {
apiUrl("$APPLICATIONS_BASE_URL/${appId}/icon")
}