@zimic/interceptor 0.19.1-canary.5 → 0.19.1-canary.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,122 +11,47 @@ export interface HttpInterceptorRequestSaving {
11
11
  safeLimit: number;
12
12
  }
13
13
 
14
- /**
15
- * An interceptor to handle HTTP requests and return mock responses. The methods, paths, status codes, parameters, and
16
- * responses are statically-typed based on the provided service schema.
17
- *
18
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor `HttpInterceptor` API reference}
19
- */
14
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor `HttpInterceptor` API reference} */
20
15
  // The schema is still a generic type for backward compatibility.
21
16
  // eslint-disable-next-line @typescript-eslint/naming-convention
22
17
  export interface HttpInterceptor<_Schema extends HttpSchema> {
23
- /**
24
- * The base URL used by the interceptor.
25
- *
26
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorbaseurl `interceptor.baseURL` API reference}
27
- */
18
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorbaseurl `interceptor.baseURL` API reference} */
28
19
  baseURL: string;
29
20
 
30
- /**
31
- * Configures if the intercepted requests are saved and how they are handled.
32
- *
33
- * @see {@link https://zimic.dev/docs/interceptor/api/create-http-interceptor `createHttpInterceptor` API reference}
34
- * @see {@link https://zimic.dev/docs/interceptor/guides/http/testing Testing}
35
- */
21
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorrequestsaving `interceptor.requestSaving` API reference} */
36
22
  requestSaving: HttpInterceptorRequestSaving;
37
23
 
38
- /**
39
- * The strategy to use for unhandled requests. If a request starts with the base URL of the interceptor, but no
40
- * matching handler exists, this strategy will be used. If a function is provided, it will be called with the
41
- * unhandled request.
42
- *
43
- * @see {@link https://zimic.dev/docs/interceptor/guides/http/unhandled-requests Unhandled requests}
44
- */
24
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptoronunhandledrequest `interceptor.onUnhandledRequest` API reference} */
45
25
  onUnhandledRequest?: UnhandledRequestStrategy;
46
26
 
47
27
  /**
48
- * The platform the interceptor is running on.
49
- *
50
28
  * @readonly
51
29
  * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorplatform `interceptor.platform` API reference}
52
30
  */
53
31
  get platform(): HttpInterceptorPlatform | null;
54
32
 
55
33
  /**
56
- * Whether the interceptor is currently running and ready to use.
57
- *
58
34
  * @readonly
59
35
  * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorisrunning `interceptor.isRunning` API reference}
60
36
  */
61
37
  get isRunning(): boolean;
62
38
 
63
- /**
64
- * Starts the interceptor, allowing it to intercept HTTP requests.
65
- *
66
- * When targeting a browser environment, make sure to run `npx zimic-interceptor browser init <publicDirectory>` on
67
- * your terminal before starting the worker. This initializes the mock service worker in your public directory.
68
- *
69
- * @throws {UnregisteredServiceWorkerError} When the worker is targeting a browser environment and the mock service
70
- * worker is not registered.
71
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorstart `interceptor.start()` API reference}
72
- */
39
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorstart `interceptor.start()` API reference} */
73
40
  start: () => Promise<void>;
74
41
 
75
- /**
76
- * Stops the interceptor, preventing it from intercepting HTTP requests. Stopped interceptors are automatically
77
- * cleared, exactly as if
78
- * {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorclear `interceptor.clear()`} had been
79
- * called.
80
- *
81
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorstop `interceptor.stop()` API reference}
82
- */
42
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorstop `interceptor.stop()` API reference} */
83
43
  stop: () => Promise<void>;
84
44
 
85
- /**
86
- * Checks if all handlers created by this interceptor have matched the number of requests declared with
87
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes `handler.times()`}.
88
- *
89
- * If some handler has matched fewer or more requests than expected, this method will throw a `TimesCheckError` error,
90
- * including a stack trace to the
91
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes `handler.times()`} that was not
92
- * satisfied.
93
- *
94
- * This is useful in an `afterEach` hook (or equivalent) to make sure that all expected requests were made at the end
95
- * of each test.
96
- *
97
- * When {@link https://zimic.dev/docs/interceptor/api/create-http-interceptor `requestSaving.enabled`} is `true` in
98
- * your interceptor, the `TimesCheckError` errors will also list each unmatched request with diff of the expected and
99
- * received data. This is useful for debugging requests that did not match a handler with
100
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}.
101
- *
102
- * @throws {TimesCheckError} If some handler has matched less or more requests than the expected number of requests.
103
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorchecktimes `interceptor.checkTimes()` API reference}
104
- * @see {@link https://zimic.dev/docs/interceptor/guides/http/testing Testing guide}
105
- */
45
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorchecktimes `interceptor.checkTimes()` API reference} */
106
46
  checkTimes: (() => void) | (() => Promise<void>);
107
47
 
108
- /**
109
- * Clears the interceptor and all of its
110
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} instances, including their
111
- * registered responses and intercepted requests. After calling this method, the interceptor will no longer intercept
112
- * any requests until new mock responses are registered.
113
- *
114
- * This method is useful to reset the interceptor mocks between tests.
115
- *
116
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
117
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorclear `interceptor.clear()` API reference}
118
- */
48
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorclear `interceptor.clear()` API reference} */
119
49
  clear: (() => void) | (() => Promise<void>);
120
50
  }
121
51
 
122
52
  /**
123
- * A local interceptor to handle HTTP requests and return mock responses. The methods, paths, status codes, parameters,
124
- * and responses are statically-typed based on the provided service schema.
125
- *
126
- * To intercept HTTP requests, the interceptor must have been started with
127
- * {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorstart `interceptor.start()`}.
128
- *
129
53
  * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor `HttpInterceptor` API reference}
54
+ * @see {@link https://zimic.dev/docs/interceptor/guides/http/local-interceptors Using local interceptors}
130
55
  */
131
56
  export interface LocalHttpInterceptor<Schema extends HttpSchema> extends HttpInterceptor<Schema> {
132
57
  /** @readonly */
@@ -134,165 +59,25 @@ export interface LocalHttpInterceptor<Schema extends HttpSchema> extends HttpInt
134
59
 
135
60
  onUnhandledRequest?: UnhandledRequestStrategy.Local;
136
61
 
137
- /**
138
- * Creates a GET {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
139
- * The path and method must be declared in the interceptor schema.
140
- *
141
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
142
- * interceptor, and the method, path,
143
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
144
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
145
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
146
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
147
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
148
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
149
- * it is created **after** the generic one.
150
- *
151
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
152
- * to specify the original path as a type parameter to get type-inference and type-validation.
153
- * @returns A GET {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
154
- * provided path. The path and method must be declared in the interceptor schema.
155
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
156
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
157
- */
62
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorget `interceptor.get()` API reference} */
158
63
  get: SyncHttpInterceptorMethodHandler<Schema, 'GET'>;
159
64
 
160
- /**
161
- * Creates a POST {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
162
- * The path and method must be declared in the interceptor schema.
163
- *
164
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
165
- * interceptor, and the method, path,
166
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
167
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
168
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
169
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
170
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
171
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
172
- * it is created **after** the generic one.
173
- *
174
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
175
- * to specify the original path as a type parameter to get type-inference and type-validation.
176
- * @returns A POST {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
177
- * provided path. The path and method must be declared in the interceptor schema.
178
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
179
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
180
- */
65
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorpost `interceptor.post()` API reference} */
181
66
  post: SyncHttpInterceptorMethodHandler<Schema, 'POST'>;
182
67
 
183
- /**
184
- * Creates a PATCH {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
185
- * The path and method must be declared in the interceptor schema.
186
- *
187
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
188
- * interceptor, and the method, path,
189
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
190
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
191
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
192
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
193
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
194
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
195
- * it is created **after** the generic one.
196
- *
197
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
198
- * to specify the original path as a type parameter to get type-inference and type-validation.
199
- * @returns A PATCH {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
200
- * provided path. The path and method must be declared in the interceptor schema.
201
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
202
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
203
- */
68
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorpatch `interceptor.patch()` API reference} */
204
69
  patch: SyncHttpInterceptorMethodHandler<Schema, 'PATCH'>;
205
70
 
206
- /**
207
- * Creates a PUT {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
208
- * The path and method must be declared in the interceptor schema.
209
- *
210
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
211
- * interceptor, and the method, path,
212
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
213
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
214
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
215
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
216
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
217
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
218
- * it is created **after** the generic one.
219
- *
220
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
221
- * to specify the original path as a type parameter to get type-inference and type-validation.
222
- * @returns A PUT {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
223
- * provided path. The path and method must be declared in the interceptor schema.
224
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
225
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
226
- */
71
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorput `interceptor.put()` API reference} */
227
72
  put: SyncHttpInterceptorMethodHandler<Schema, 'PUT'>;
228
73
 
229
- /**
230
- * Creates a DELETE {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a
231
- * path. The path and method must be declared in the interceptor schema.
232
- *
233
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
234
- * interceptor, and the method, path,
235
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
236
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
237
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
238
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
239
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
240
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
241
- * it is created **after** the generic one.
242
- *
243
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
244
- * to specify the original path as a type parameter to get type-inference and type-validation.
245
- * @returns A DELETE {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
246
- * provided path. The path and method must be declared in the interceptor schema.
247
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
248
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
249
- */
74
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptordelete `interceptor.delete()` API reference} */
250
75
  delete: SyncHttpInterceptorMethodHandler<Schema, 'DELETE'>;
251
76
 
252
- /**
253
- * Creates a HEAD {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
254
- * The path and method must be declared in the interceptor schema.
255
- *
256
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
257
- * interceptor, and the method, path,
258
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
259
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
260
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
261
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
262
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
263
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
264
- * it is created **after** the generic one.
265
- *
266
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
267
- * to specify the original path as a type parameter to get type-inference and type-validation.
268
- * @returns A HEAD {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
269
- * provided path. The path and method must be declared in the interceptor schema.
270
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
271
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
272
- */
77
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorhead `interceptor.head()` API reference} */
273
78
  head: SyncHttpInterceptorMethodHandler<Schema, 'HEAD'>;
274
79
 
275
- /**
276
- * Creates an OPTIONS {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a
277
- * path. The path and method must be declared in the interceptor schema.
278
- *
279
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
280
- * interceptor, and the method, path,
281
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
282
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
283
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
284
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
285
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
286
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
287
- * it is created **after** the generic one.
288
- *
289
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
290
- * to specify the original path as a type parameter to get type-inference and type-validation.
291
- * @returns An OPTIONS {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
292
- * provided path. The path and method must be declared in the interceptor schema.
293
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
294
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
295
- */
80
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptoroptions `interceptor.options()` API reference} */
296
81
  options: SyncHttpInterceptorMethodHandler<Schema, 'OPTIONS'>;
297
82
 
298
83
  checkTimes: () => void;
@@ -301,216 +86,37 @@ export interface LocalHttpInterceptor<Schema extends HttpSchema> extends HttpInt
301
86
  }
302
87
 
303
88
  /**
304
- * A remote interceptor to handle HTTP requests and return mock responses. The methods, paths, status codes, parameters,
305
- * and responses are statically-typed based on the provided service schema.
306
- *
307
- * To intercept HTTP requests, the interceptor must have been started with
308
- * {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorstart `interceptor.start()`} and an
309
- * {@link https://zimic.dev/docs/interceptor/cli/server interceptor server} should be running.
310
- *
311
89
  * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor `HttpInterceptor` API reference}
90
+ * @see {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors Using remote interceptors}
312
91
  */
313
92
  export interface RemoteHttpInterceptor<Schema extends HttpSchema> extends HttpInterceptor<Schema> {
314
93
  /** @readonly */
315
94
  get type(): 'remote';
316
95
 
317
- /**
318
- * Options to authenticate the interceptor when connecting to an interceptor server. This is required if the
319
- * interceptor server was started with the `--tokens-dir` option.
320
- *
321
- * @see {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors#interceptor-server-authentication Interceptor server authentication}
322
- */
323
- auth?: RemoteHttpInterceptorOptions['auth'];
324
-
325
96
  onUnhandledRequest?: UnhandledRequestStrategy.Remote;
326
97
 
327
- /**
328
- * Creates a GET {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
329
- * The path and method must be declared in the interceptor schema.
330
- *
331
- * When using a {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors remote interceptor}, creating
332
- * a handler is an asynchronous operation, so you need to `await` it. You can also chain any number of operations and
333
- * apply them by awaiting the handler.
334
- *
335
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
336
- * interceptor, and the method, path,
337
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
338
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
339
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
340
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
341
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
342
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
343
- * it is created **after** the generic one.
344
- *
345
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
346
- * to specify the original path as a type parameter to get type-inference and type-validation.
347
- * @returns A GET {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
348
- * provided path. The path and method must be declared in the interceptor schema.
349
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
350
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
351
- */
98
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorauth `interceptor.auth` API reference} */
99
+ auth?: RemoteHttpInterceptorOptions['auth'];
100
+
101
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorget `interceptor.get()` API reference} */
352
102
  get: AsyncHttpInterceptorMethodHandler<Schema, 'GET'>;
353
103
 
354
- /**
355
- * Creates a POST {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
356
- * The path and method must be declared in the interceptor schema.
357
- *
358
- * When using a {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors remote interceptor}, creating
359
- * a handler is an asynchronous operation, so you need to `await` it. You can also chain any number of operations and
360
- * apply them by awaiting the handler.
361
- *
362
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
363
- * interceptor, and the method, path,
364
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
365
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
366
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
367
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
368
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
369
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
370
- * it is created **after** the generic one.
371
- *
372
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
373
- * to specify the original path as a type parameter to get type-inference and type-validation.
374
- * @returns A POST {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
375
- * provided path. The path and method must be declared in the interceptor schema.
376
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
377
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
378
- */
104
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorpost `interceptor.post()` API reference} */
379
105
  post: AsyncHttpInterceptorMethodHandler<Schema, 'POST'>;
380
106
 
381
- /**
382
- * Creates a PATCH {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
383
- * The path and method must be declared in the interceptor schema.
384
- *
385
- * When using a {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors remote interceptor}, creating
386
- * a handler is an asynchronous operation, so you need to `await` it. You can also chain any number of operations and
387
- * apply them by awaiting the handler.
388
- *
389
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
390
- * interceptor, and the method, path,
391
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
392
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
393
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
394
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
395
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
396
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
397
- * it is created **after** the generic one.
398
- *
399
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
400
- * to specify the original path as a type parameter to get type-inference and type-validation.
401
- * @returns A PATCH {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
402
- * provided path. The path and method must be declared in the interceptor schema.
403
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
404
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
405
- */
107
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorpatch `interceptor.patch()` API reference} */
406
108
  patch: AsyncHttpInterceptorMethodHandler<Schema, 'PATCH'>;
407
109
 
408
- /**
409
- * Creates a PUT {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
410
- * The path and method must be declared in the interceptor schema.
411
- *
412
- * When using a {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors remote interceptor}, creating
413
- * a handler is an asynchronous operation, so you need to `await` it. You can also chain any number of operations and
414
- * apply them by awaiting the handler.
415
- *
416
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
417
- * interceptor, and the method, path,
418
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
419
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
420
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
421
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
422
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
423
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
424
- * it is created **after** the generic one.
425
- *
426
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
427
- * to specify the original path as a type parameter to get type-inference and type-validation.
428
- * @returns A PUT {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
429
- * provided path. The path and method must be declared in the interceptor schema.
430
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
431
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
432
- */
110
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorput `interceptor.put()` API reference} */
433
111
  put: AsyncHttpInterceptorMethodHandler<Schema, 'PUT'>;
434
112
 
435
- /**
436
- * Creates a DELETE {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a
437
- * path. The path and method must be declared in the interceptor schema.
438
- *
439
- * When using a {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors remote interceptor}, creating
440
- * a handler is an asynchronous operation, so you need to `await` it. You can also chain any number of operations and
441
- * apply them by awaiting the handler.
442
- *
443
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
444
- * interceptor, and the method, path,
445
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
446
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
447
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
448
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
449
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
450
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
451
- * it is created **after** the generic one.
452
- *
453
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
454
- * to specify the original path as a type parameter to get type-inference and type-validation.
455
- * @returns A DELETE {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
456
- * provided path. The path and method must be declared in the interceptor schema.
457
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
458
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
459
- */
113
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptordelete `interceptor.delete()` API reference} */
460
114
  delete: AsyncHttpInterceptorMethodHandler<Schema, 'DELETE'>;
461
115
 
462
- /**
463
- * Creates a HEAD {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a path.
464
- * The path and method must be declared in the interceptor schema.
465
- *
466
- * When using a {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors remote interceptor}, creating
467
- * a handler is an asynchronous operation, so you need to `await` it. You can also chain any number of operations and
468
- * apply them by awaiting the handler.
469
- *
470
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
471
- * interceptor, and the method, path,
472
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
473
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
474
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
475
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
476
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
477
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
478
- * it is created **after** the generic one.
479
- *
480
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
481
- * to specify the original path as a type parameter to get type-inference and type-validation.
482
- * @returns A HEAD {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
483
- * provided path. The path and method must be declared in the interceptor schema.
484
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
485
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
486
- */
116
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptorhead `interceptor.head()` API reference} */
487
117
  head: AsyncHttpInterceptorMethodHandler<Schema, 'HEAD'>;
488
118
 
489
- /**
490
- * Creates an OPTIONS {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for a
491
- * path. The path and method must be declared in the interceptor schema.
492
- *
493
- * When using a {@link https://zimic.dev/docs/interceptor/guides/http/remote-interceptors remote interceptor}, creating
494
- * a handler is an asynchronous operation, so you need to `await` it. You can also chain any number of operations and
495
- * apply them by awaiting the handler.
496
- *
497
- * After a request is intercepted, Zimic tries to find a handler that matches it, considering the base URL of the
498
- * interceptor, and the method, path,
499
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlerwithrestriction restrictions}, and
500
- * {@link https://zimic.dev/docs/interceptor/api/http-request-handler#handlertimes limits on the number of requests} of
501
- * the handler. The handlers are checked from the **last** one created to the first one, so new handlers have
502
- * preference over older ones. This allows you to declare generic and specific handlers based on their order of
503
- * creation. For example, a generic handler for `GET /users` can return an empty list, while a specific handler in a
504
- * test case can return a list with some users. In this case, the specific handler will be considered first as long as
505
- * it is created **after** the generic one.
506
- *
507
- * @param path The path to intercept. Paths with dynamic parameters, such as `/users/:id`, are supported, but you need
508
- * to specify the original path as a type parameter to get type-inference and type-validation.
509
- * @returns An OPTIONS {@link https://zimic.dev/docs/interceptor/api/http-request-handler `HttpRequestHandler`} for the
510
- * provided path. The path and method must be declared in the interceptor schema.
511
- * @throws {NotRunningHttpInterceptorError} If the interceptor is not running.
512
- * @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#declaring-request-handlers Declaring request handlers}
513
- */
119
+ /** @see {@link https://zimic.dev/docs/interceptor/api/http-interceptor#interceptoroptions `interceptor.options()` API reference} */
514
120
  options: AsyncHttpInterceptorMethodHandler<Schema, 'OPTIONS'>;
515
121
 
516
122
  checkTimes: () => Promise<void>;