docs: fix HttpClient logging's sample

This commit is contained in:
WilliamKoza 2017-07-16 12:00:40 +02:00 committed by Alex Rickabaugh
parent 7e72317059
commit 8c81c62d46
1 changed files with 2 additions and 2 deletions

View File

@ -389,12 +389,12 @@ export class TimingInterceptor implements HttpInterceptor {
constructor(private auth: AuthService) {}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const elapsed = Date.now();
const started = Date.now();
return next
.handle(req)
.do(event => {
if (event instanceof HttpResponse) {
const time = Date.now() - started;
const elapsed = Date.now() - started;
console.log(`Request for ${req.urlWithParams} took ${elapsed} ms.`);
}
});