dart - 如何在我的删除 http 请求中添加正文
问题描述
我想在我的删除 http 请求中添加一个正文,但似乎 http 包不接受它
http.delete('${config.basicUrl}removeFavorite', body: json.encode(requestBody))
有什么解决办法吗?
解决方案
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();
}
推荐阅读
- git - 如何为 lcoal git (github) 存储库永久添加 SSH 密钥?
- python - PEM 编码中 ECC 私钥的 Python 导入失败
- python - Python IDLE多语句错误是shell模式
- java - 如何在 Java 中将字符串拆分为 2 部分?
- android - 找不到“com.afollestad:material-dialogs:0.7.9.1”
- c# - 启动多个阻塞任务的奇怪行为
- list - 如何使 switch.toggle() 在 ForEach 循环中生效?
- cufflinks - 袖扣消除烛台图表中的空白
- meteor - 如何在流星中接收辅助函数的承诺值?
- node.js - 猫鼬填充未填充必填字段