我想在我的删除http请求中添加一个正文,但是http pakage似乎不接受它
http.delete('${config.basicUrl}removeFavorite', body: json.encode(requestBody))
对此有什么解决方案吗?
答案 0 :(得分:2)
final client = http.Client();
try {
final response = await client.send(
http.Request("DELETE", Uri.parse("${config.basicUrl}removeFavorite"))
..headers["authorization"] = "Bearer $bearer"
..body = "...");
//
} finally {
client.close();
}