Flutter http post response is limiting to 1023 characters

此生再无相见时 提交于 2021-01-29 06:05:22

问题


I'm creating an app using flutter, in this I'm creating a post request then reading the response as string (later to convert into 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);
});

It's working fine and getting the response, but as my question says, response is limited to 1023 characters. I checked it with postman and found the response is coming properly as needed.

It would be great if anyone would help me out to solve this issue.

Thanks in advance

来源:https://stackoverflow.com/questions/55361422/flutter-http-post-response-is-limiting-to-1023-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!