有人为Angular 6应用程序实施Tea Leaf分析吗?
我正在节点服务器(app.js)上创建一个cookie,然后期望 Cookie随Angular应用程序的每个API服务调用一起提供。 Cookie必须在每个API的HTTP请求标头中可见 从Angular应用程序调用。
请告诉我是否可以克隆HTTP响应 Angular的每个API服务调用中都保留有cookie的标头 应用?
此处服务API位于IBM Web Sphere上。尝试放置 withCredentials:通过在以下位置克隆HTTP请求标头来实现true TestInterceptor文件。
/* Interceptor code goes here...*/
@Injectable()
export class TestInterceptor implements HttpInterceptor {
intercept(req: HttpRequest < any > ,
next: HttpHandler): Observable < HttpEvent < any >>
{
req = req.clone({
headers: req.headers.set('Accept', 'application/json'),
withCredentials: true
});
return next.handle(req).pipe(catchError(error => {
return throwError(error);
}));
}
}