The RegisterOptions interface is used to configure the registration options for the network debugger. Below are detailed descriptions of each option and their default values.
Here is an example of using RegisterOptions:
import { RegisterOptions, register } from 'node-network-devtools'
const options: RegisterOptions = {
port: 5270,
serverPort: 5271,
autoOpenDevtool: true,
intercept: {
fetch: true,
normal: true
}
}
// Use options to register the network debugger
register(options)- Description: Main process port
- Default value:
5270
- Description: CDP server port for Devtool
- Link: devtools://devtools/bundled/inspector.html?ws=localhost:${serverPort}
- Default value:
5271
- Description: Whether to automatically open Devtool
- Default value:
true
- Description: Options for intercepting different types of requests.
If a property is set to
false, that specific type of request will not be intercepted. By default, all are intercepted if not explicitly set.
- Description: Whether to intercept
fetchrequests. - Default value:
true
- Description: Whether to intercept
http/httpsrequests. - Default value:
true
- Description: Options for intercepting
undicirequests. Set tofalseto disable allundiciinterception. Otherwise, configure specificundiciinterception options. - Default value:
false - Options:
fetch: Whether to interceptundici'sfetchrequests. Defaults tofalse.normal: Whether to interceptundici's normal requests. Defaults tofalse.
The ConnectOptions interface configures options for connecting to the network debugger.
- Description: Main process port
- Default value:
5270
The UnregisterOptions interface configures options for unregistering the network debugger.
- Description: Main process port
- Default value:
5270
The SetRequestInterceptorOptions interface configures options for setting a request interceptor.
- Description: Main process port
- Default value:
5270
- Description: A function to intercept and modify outgoing requests.
The SetResponseInterceptorOptions interface configures options for setting a response interceptor.
- Description: Main process port
- Default value:
5270
- Description: A function to intercept and modify incoming responses.
The RemoveRequestInterceptorOptions interface configures options for removing a request interceptor.
- Description: Main process port
- Default value:
5270
The RemoveResponseInterceptorOptions interface configures options for removing a response interceptor.
- Description: Main process port
- Default value:
5270