【发布时间】:2026-02-20 09:10:01
【问题描述】:
我的组件的 query() 函数中有以下代码,我想模拟 http post 返回的结果,我该怎么做?
query(){
Observable.forkJoin(
this.http.post<any[]>(URL, jsonBody1, postJson) .map((res) => res),
this.http.post<any[]>(URL, jsonBody2, postJson) .map((res) => res)
)
.subscribe(res => this.handleResponse(res))
}
【问题讨论】:
标签: angular karma-jasmine angular-http angular-http-interceptors angular-httpclient