我知道这个问题可能是多余的,但我正在尝试通过 POST 请求向 Flutter 中的 Microsoft Custom Vision 发送 png 文件。这是我的代码:
void _makeRequest (File file) async {
String url = "<url>";
Map<String, String> headers = {
"Content-Type": "application/octet-stream",
"Prediction-Key": "<key>",
};
var bytes = file.readAsBytesSync();
var response = await http.post(
url,
headers: headers,
body: bytes,
);
print(response.body);
print(response.statusCode);
}
当我运行这段代码时,我得到了这个响应:
{"code":"ErrorUnknown","message":"The request entity's media type 'appliction/octet-stream' is not supported for this resource."}