InterceptorServer
An interceptor server can be used to handle requests and return mock responses in combination with remote interceptors, which declare the responses the server should return for a given request. Interceptor servers and remote interceptors communicate with remote-procedure calls (RPC) over WebSocket.
Related:
server.hostname
​
The hostname of the server. It can be reassigned to a new value if the server is not running.
Type: string
server.port
​
The port of the server. It can be reassigned to a new value if the server is not running.
Type: number | undefined
server.logUnhandledRequests
​
Whether to log warnings about unhandled requests to the console. It can be reassigned to a new value.
Type: boolean
(default: true
)
server.tokensDirectory
​
The directory where the authorized interceptor authentication tokens are saved. If provided, only remote interceptors bearing a valid token will be accepted. This option is essential if you are exposing your interceptor server publicly. For local development and testing, though, a tokens directory is optional.
Type: string | undefined
Related:
server.isRunning
​
Whether the server is running.
Type: boolean
(readonly)
server.start()
​
Starts the server. It will automatically stop if a process exit event is detected, such as SIGINT, SIGTERM, or an uncaught exception.
await server.start();
Returns: Promise<void>
server.stop()
​
Stops the server.
await server.stop();
Returns: Promise<void>