我尝试使用多部分表单数据发送文件,但我得到的只是以下错误:
{"description":"错误:错误请求:chat_id 为空","error_code":400,"ok":false}
这是我的代码片段。任何人都可以帮我解决我犯错误的地方吗?
public HttpResponse<jsonnode> sendDocument(Integer chat_id,File f1) throws UnirestException {
return Unirest.post(endpoint + token + "/sendDocument")
header("accept", "application/json")
.field("chat_id", chat_id)
.field("document", f1)
.asJson();
}