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
This commit is contained in:
pavlenko 2021-06-29 15:55:06 +05:00 committed by Jessica Janiuk
parent 8528073f6c
commit f3965ff834
2 changed files with 2 additions and 2 deletions

View File

@ -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 */

View File

@ -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.