From f3965ff8346487a554caea9962b35faf5328da1b Mon Sep 17 00:00:00 2001 From: pavlenko Date: Tue, 29 Jun 2021 15:55:06 +0500 Subject: [PATCH] docs: setting context value inside an interceptor (#42699) Usage of `get`/`set` methods should be done on a context object instead of a `HttpRequest` instance. PR Close #42699 --- aio/content/examples/http/src/app/http-interceptors/index.ts | 2 +- .../http/src/app/http-interceptors/retry-interceptor.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aio/content/examples/http/src/app/http-interceptors/index.ts b/aio/content/examples/http/src/app/http-interceptors/index.ts index 6a1a7450bc..d31d6696e0 100644 --- a/aio/content/examples/http/src/app/http-interceptors/index.ts +++ b/aio/content/examples/http/src/app/http-interceptors/index.ts @@ -14,7 +14,7 @@ import { NoopInterceptor } from './noop-interceptor'; // #enddocregion interceptor-providers import { TrimNameInterceptor } from './trim-name-interceptor'; import { UploadInterceptor } from './upload-interceptor'; - +import { RetryInterceptor } from './retry-interceptor'; // #docregion interceptor-providers /** Http interceptor providers in outside-in order */ diff --git a/aio/content/examples/http/src/app/http-interceptors/retry-interceptor.ts b/aio/content/examples/http/src/app/http-interceptors/retry-interceptor.ts index 2eb562625d..fa3290e524 100644 --- a/aio/content/examples/http/src/app/http-interceptors/retry-interceptor.ts +++ b/aio/content/examples/http/src/app/http-interceptors/retry-interceptor.ts @@ -39,7 +39,7 @@ export class RetryInterceptor implements HttpInterceptor { tap(null, () => { // An error has occurred, so increment this request's ERROR_COUNT. - req.set(ERROR_COUNT, req.get(ERROR_COUNT) + 1); + req.context.set(ERROR_COUNT, req.context.get(ERROR_COUNT) + 1); }), // #docregion reading-context // Retry the request a configurable number of times.