【发布时间】:2021-01-26 00:16:49
【问题描述】:
我正在为我的 api 使用以下代码。此 api 在 postman 中工作,但在 http flutter 中显示 404 错误代码。
我的颤振代码:
RaisedButton(
onPressed: () {
apiCall();
},
child: Text("Press"),
)
Future apiCall() async {
var body =
jsonEncode({"filepath": "patient/reports/1602333458533-Liver.jpg"});
try {
await http
.post('http://3.6.197.52:3100/downloadFile',
headers: {"Accept": "Application/json"}, body: body)
.then((http.Response response) => print(response.statusCode));
} catch (e) {
print(e);
}
}
它给出了错误代码 404。
以下是邮递员的结果:
【问题讨论】:
标签: api flutter http flutter-web