0

我有服务器和客户端。使用 Postman 测试服务器。我在客户端发布请求时遇到问题。

  try {
    var user = CIMUser('admin', 'admin');
    packet!.addInstance(user);
    var client = HttpClient();
    request.headers.contentType = ContentType.json;
    request.write(packet.toJson());
    var response = await request.close();
    var result = await response.first;
    print(result);
  }
  catch(e){
    print(e);
  }

"var response = await request.close();" Throws exception "HttpException: Connection closed before full header was received, uri = http://127.0.0.1:8888/user/first"

**get** requests works fine
4

0 回答 0