我正在尝试通过客户给予我的API读取json文件,但是它显示HTTP错误405,说方法不允许。请问有人能告诉我我做错了什么吗?
这是客户给我的API请求代码段:
curl 'http://finelistings.com/backend/apis/webbrands/' -H 'Content-Type: application/json' -H 'Accept: application/json' --data-binary '{}' --compressed --insecure
Future<String> getData() async {
var response = await http.get(
Uri.encodeFull("http://finelistings.com/backend/apis/webbrands/"),
headers: {
"Accept": "application/json",
}
);
Map<String, String> data = jsonDecode(response.body);
print(data);
}
--data-binary...
部分,它会发送一个请求体到服务器,这必须使用POST方法来完成。 - undefined