参见英文答案 >
duplicate ajax calls in angularjs2个
在代码中添加标题后,重复调用正在发生.找到图像以查看两次发生的呼叫.
在代码中添加标题后,重复调用正在发生.找到图像以查看两次发生的呼叫.
AUTH-interceptor.ts
导出类AuthInterceptor实现HttpInterceptor {
intercept(req: HttpRequest<any>,next: HttpHandler): Observable<HttpEvent<any>> { const clonedRequest = req.clone({ headers: req.headers.set('X-CustomAuthHeader','some-auth-token') }); console.log("new headers",clonedRequest.headers.keys()); return next.handle(clonedRequest); }
}