当我尝试从本地服务器请求数据时,发生以下错误:ClientException (Connection closed before full header was received)
码:
void authanticate() async {
String authString =
'http' + '://' + ip + ':' + port + '/' + rec + '?password=' + pass;
print(authString);
var response = await get(authString);
print(response.statusCode);
print(response.body);
}
有没有办法解决此错误?
最佳答案
这应该用作http.get(authString)
void authanticate() async {
String authString =
'https' + '://' + ip + ':' + port + '/' + rec + '?password=' + pass;
print(authString);
var response = await http.get(authString);
print(response.statusCode);
print(response.body);
}
关于http - 加载数据时客户端异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63646310/