我正在使用flutter创建一个应用,在此过程中,我创建了一个发布请求,然后将响应读取为字符串(后来转换为json)。
Future<String> post([String url = "https://example.com/get-new"]) async {
return await http.post(Uri.encodeFull(url),
headers: {"Accept": "application/json"}).then((http.Response response) {
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode > 400) {
throw new Exception("Error while fetching data");
}
return response.body;
});
}
post().then((val){
print(val);
});
它可以正常工作并获得响应,但是正如我的问题所述,响应仅限于1023个字符。我和邮递员检查了一下,发现响应可以根据需要正确地发送。
如果有人能帮助我解决这个问题,那就太好了。
预先感谢