fix: fix interceptors
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
import { HttpFeatureKind } from '@ngify/http';
|
||||
import { HttpClientTestingBackend } from '@ngify/http/testing';
|
||||
import { InjectionToken, type Provider } from 'injection-js';
|
||||
import { HTTP_BACKEND, provideHttpClient } from 'oidc-client-rx';
|
||||
|
||||
export function provideHttpClientTesting() {
|
||||
return {
|
||||
provide: HttpFeatureKind.Backend,
|
||||
useClass: HttpClientTestingBackend,
|
||||
};
|
||||
export const HTTP_CLIENT_TEST_CONTROLLER =
|
||||
new InjectionToken<HttpClientTestingBackend>('HTTP_CLIENT_TEST_CONTROLLER');
|
||||
|
||||
export function provideHttpClientTesting(): Provider[] {
|
||||
const backend = new HttpClientTestingBackend();
|
||||
return [
|
||||
{
|
||||
provide: HTTP_CLIENT_TEST_CONTROLLER,
|
||||
useValue: backend,
|
||||
},
|
||||
{
|
||||
provide: HTTP_BACKEND,
|
||||
useValue: backend,
|
||||
},
|
||||
...provideHttpClient(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ export {
|
||||
} from './spy';
|
||||
export { createRetriableStream } from './create-retriable-stream.helper';
|
||||
export { MockRouter, mockRouterProvider } from './router';
|
||||
export { provideHttpClientTesting } from './http';
|
||||
export { provideHttpClientTesting, HTTP_CLIENT_TEST_CONTROLLER } from './http';
|
||||
|
||||
Reference in New Issue
Block a user