【发布时间】:2022-11-07 17:37:54
【问题描述】:
试图在我的控制台上显示数据流,但可能不知道正确的工具。如果我尝试从 curl 获取数据,它工作正常,看起来像这样:
C:\Users\user>curl localhost:8080/slow/5
5
4
3
2
1
0
C:\Users\user>
首先我尝试使用标准的http get请求,
constructor(
private http: HttpClient,
private ngzone: NgZone
) {
this.http.get('/slow/5').subscribe(x => console.log(x))
}
这是我在 5 秒后得到的错误:
error: Object { error: SyntaxError, text: "5\n4\n3\n2\n1\n0\n" }
尝试使用 EventSource 方法,但这甚至无法连接它。 代理工作正常。 有任何想法吗?首先十分感谢。
【问题讨论】: