使用Angular 4.3.1和HttpClient,我需要通过异步服务将请求和响应修改为httpClient的HttpInterceptor,
修改请求的示例:
export class UseAsyncServiceInterceptor implements HttpInterceptor {
constructor( private asyncService: AsyncService) { }
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// input request of applyLogic, output is async elaboration on request
this.asyncService.applyLogic(req).subscribe((modifiedReq) => {
const newReq = req.clone(modifiedReq);
return next.handle(newReq);
});
/* HERE, I have to return the Observable with next.handle but obviously
** I have a problem because I have to return
** newReq and here is not available. */
}
}
Run Code Online (Sandbox Code Playgroud)
响应的问题不同,但我需要再次使用apply来更新响应.在这种情况下,角度指南建议如下:
return next.handle(req).do(event => {
if …Run Code Online (Sandbox Code Playgroud) The Simulator Version 10.0 (SimulatorApp-835.2.1), the Xcode version is 9.1
Seems that all the https connections are evaluated as not trasted, it is affected after the upgrade of Xcode and simulator.
I'm sure that the https connection are with valid certificate also because the same https://support.apple.com get Not trusted problem inside the simulator.
With safari I get some details about "not trusted" site
clicking on
showDetails
and
view the certificated
I already tried to: …