httpclient - Google Dart HTTP客户端问题

标签 httpclient dart

因此,我升级了我的IDE和SDK,现在下面的代码不再起作用。我在此处添加一些文本,以尝试绕过该站点的法西斯验证,这是非常激进的。

String URL = "http://www.google.com";
Future future = client.getUrl(Uri.parse(URL))
    .then((HttpClientRequest request) {
        return request.close();
    }).then((HttpClientResponse response) {
        print('Status code: ${response.statusCode}');
        print('Headers\n${response.headers}');
    });
}); 

我现在收到以下异常。
Uncaught Error: Bad state: No elements
Stack Trace:

有任何想法吗?

最佳答案

在Windows上使用Dart 0.6.3.3_r24898为我工作。

您确定这就是您拥有的所有代码吗?在堆栈跟踪中,我看到了WebSocketImpl,您是否正在使用WebSockets?

关于httpclient - Google Dart HTTP客户端问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17768990/

相关文章:

rest - Grails rest 插件 SSLexception 奇怪的域名比较 (domainname/ip-address)

c# - 反序列化 JSON 时出现线程错误

java - 使用 Apache HttpClient 定义源 IP 地址

android - Xamarin 使用 OKHttpNetworkHandler 和 AFNetworkHandler 的引用

localhost - esp32 connect() : socket error on fd 48, errno : 104, "Connection reset by peer"

dart - flutter 中所有设备的填充

dart - Flutter 根 Column 小部件扩展到整个屏幕,为什么?

dart - 为什么 dart 的 listSync() 在 Windows 和 Ubuntu 上表现不同?

dart - 如何使用 Dart SpeechSynthesis 类?

performance - Canvas 多个文本绘制性能