MCPcopy Create free account
hub / github.com/angular/angular / configureInterceptor

Function configureInterceptor

packages/common/http/test/provider_spec.ts:61–78  ·  view source on GitHub ↗
(interceptor: HttpInterceptorFn)

Source from the content-addressed store, hash-verified

59 for (const kind of ['functional', 'legacy']) {
60 describe(`${kind} interceptor stability`, () => {
61 function configureInterceptor(interceptor: HttpInterceptorFn): void {
62 TestBed.configureTestingModule({
63 providers:
64 kind === 'functional'
65 ? [provideHttpClient(withInterceptors([interceptor]))]
66 : [
67 provideHttpClient(withInterceptorsFromDi()),
68 {
69 provide: HTTP_INTERCEPTORS,
70 multi: true,
71 useValue: {
72 intercept: (req: HttpRequest<unknown>, next: HttpHandler) =>
73 interceptor(req, (request) => next.handle(request)),
74 },
75 },
76 ],
77 });
78 }
79
80 it('should become stable after a synchronous interceptor error', async () => {
81 const error = new Error('interceptor failed');

Callers 1

provider_spec.tsFile · 0.70

Calls 5

provideHttpClientFunction · 0.90
withInterceptorsFunction · 0.90
withInterceptorsFromDiFunction · 0.90
handleMethod · 0.65

Tested by

no test coverage detected