小编Pas*_*ale的帖子

如何将异步服务用于角度httpClient拦截器

使用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)

interceptor rxjs typescript angular2-observables angular

8
推荐指数
4
解决办法
5315
查看次数

iOS Simulator not works on https, all https are evaluated as not trusted

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

the result is the follow: 在此处输入图片说明

I already tried to: …

https xcode ssl-certificate ios ios-simulator

6
推荐指数
0
解决办法
1839
查看次数