@schmock/angular
v2.4.0
Published
Angular HTTP interceptor adapter for Schmock
Readme
@schmock/angular
Angular HTTP interceptor adapter for Schmock.
Part of Schmock — mock APIs from OpenAPI specs or hand-crafted routes.
Install
bun add -d @schmock/angularUsage
import { provideHttpClient, withInterceptorsFromDi } from "@angular/common/http";
import { schmock } from "@schmock/core";
import { provideSchmockInterceptor } from "@schmock/angular";
const mock = schmock();
mock("GET /users", [{ id: 1, name: "Alice" }]);
export const appConfig = {
// `withInterceptorsFromDi()` is required: bare `provideHttpClient()` never
// reads the HTTP_INTERCEPTORS token, so the mock would silently not run.
providers: [
provideHttpClient(withInterceptorsFromDi()),
provideSchmockInterceptor(mock, { baseUrl: "/api" }),
],
};Documentation
License
MIT © Khalic Lab
