Skip to content

Commit 0a88993

Browse files
docs: Refine intercept.undici documentation in options.md
1 parent 5ad68dd commit 0a88993

1 file changed

Lines changed: 70 additions & 7 deletions

File tree

apps/web/docs/options.md

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,86 @@ register(options)
4343

4444
### intercept
4545

46-
- **Description**: Options for intercepting specific packets. If set to `false`, the packet will not be intercepted.
46+
- **Description**: Options for intercepting different types of requests.
47+
If a property is set to `false`, that specific type of request will not be intercepted.
48+
By default, all are intercepted if not explicitly set.
4749

4850
#### intercept.fetch
4951

52+
- **Description**: Whether to intercept `fetch` requests.
5053
- **Default value**: `true`
5154

52-
- **Description**: Whether to intercept globalThis.fetch
53-
5455
#### intercept.normal
5556

57+
- **Description**: Whether to intercept `http/https` requests.
5658
- **Default value**: `true`
5759

58-
- **Description**: Whether to intercept requests made by http/https basic packages
59-
6060
#### intercept.undici
6161

62+
- **Description**: Options for intercepting `undici` requests. Set to `false` to disable all `undici` interception. Otherwise, configure specific `undici` interception options.
6263
- **Default value**: `false`
6364
- **Options**:
64-
- `fetch`: `false` or `{}`, not intercepted by default. Used to intercept `undici.fetch`
65-
- `normal`: `false` or `{}`, not intercepted by default. Used to intercept `undici.request`
65+
- `fetch`: Whether to intercept `undici`'s `fetch` requests. Defaults to `false`.
66+
- `normal`: Whether to intercept `undici`'s normal requests. Defaults to `false`.
67+
68+
## ConnectOptions
69+
70+
The `ConnectOptions` interface configures options for connecting to the network debugger.
71+
72+
### port
73+
74+
- **Description**: Main process port
75+
- **Default value**: `5270`
76+
77+
## UnregisterOptions
78+
79+
The `UnregisterOptions` interface configures options for unregistering the network debugger.
80+
81+
### port
82+
83+
- **Description**: Main process port
84+
- **Default value**: `5270`
85+
86+
## SetRequestInterceptorOptions
87+
88+
The `SetRequestInterceptorOptions` interface configures options for setting a request interceptor.
89+
90+
### port
91+
92+
- **Description**: Main process port
93+
- **Default value**: `5270`
94+
95+
### request
96+
97+
- **Description**: A function to intercept and modify outgoing requests.
98+
99+
## SetResponseInterceptorOptions
100+
101+
The `SetResponseInterceptorOptions` interface configures options for setting a response interceptor.
102+
103+
### port
104+
105+
- **Description**: Main process port
106+
- **Default value**: `5270`
107+
108+
### response
109+
110+
- **Description**: A function to intercept and modify incoming responses.
111+
112+
## RemoveRequestInterceptorOptions
113+
114+
The `RemoveRequestInterceptorOptions` interface configures options for removing a request interceptor.
115+
116+
### port
117+
118+
- **Description**: Main process port
119+
- **Default value**: `5270`
120+
121+
## RemoveResponseInterceptorOptions
122+
123+
The `RemoveResponseInterceptorOptions` interface configures options for removing a response interceptor.
124+
125+
### port
126+
127+
- **Description**: Main process port
128+
- **Default value**: `5270`

0 commit comments

Comments
 (0)