@jaredwray/mockhttp 1.5.0 → 1.6.0
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.
- package/README.md +18 -2
- package/dist/index.d.mts +494 -0
- package/dist/index.mjs +3523 -0
- package/package.json +26 -16
- package/dist/index.d.ts +0 -490
- package/dist/index.js +0 -4709
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaredwray/mockhttp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Mock Http - Easy way to mock http with httpbin replacement",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.
|
|
6
|
+
"main": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.mts",
|
|
7
8
|
"directories": {
|
|
8
9
|
"test": "test"
|
|
9
10
|
},
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
"test": "pnpm lint && vitest run --coverage",
|
|
13
14
|
"test:ci": "biome check --error-on-warnings && vitest run --coverage",
|
|
14
15
|
"dev": "pnpm lint && tsx src/index.ts --watch",
|
|
15
|
-
"build": "
|
|
16
|
+
"build": "tsdown src/index.ts --format esm --dts",
|
|
17
|
+
"clean": "rimraf ./node_modules ./dist ./coverage DOCKER.md",
|
|
16
18
|
"docker:build": "docker build -t jaredwray/mockhttp .",
|
|
17
19
|
"docker:run": "docker run -p 3000:3000 jaredwray/mockhttp",
|
|
18
20
|
"docker:push": "docker push jaredwray/mockhttp",
|
|
@@ -20,8 +22,8 @@
|
|
|
20
22
|
"docker:readme": "tsx ./scripts/create-docker-readme.ts",
|
|
21
23
|
"docker:compose:up": "docker-compose up -d",
|
|
22
24
|
"docker:compose:down": "docker-compose down",
|
|
23
|
-
"
|
|
24
|
-
"start": "node dist/index.
|
|
25
|
+
"prepublishOnly": "pnpm run build",
|
|
26
|
+
"start": "node dist/index.mjs"
|
|
25
27
|
},
|
|
26
28
|
"repository": {
|
|
27
29
|
"type": "git",
|
|
@@ -51,27 +53,27 @@
|
|
|
51
53
|
},
|
|
52
54
|
"homepage": "https://github.com/jaredwray/mockhttp#readme",
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"@biomejs/biome": "^2.4.
|
|
55
|
-
"@swc/core": "^1.15.
|
|
56
|
+
"@biomejs/biome": "^2.4.11",
|
|
57
|
+
"@swc/core": "^1.15.24",
|
|
56
58
|
"@types/html-escaper": "^3.0.4",
|
|
57
|
-
"@vitest/coverage-v8": "^4.1.
|
|
59
|
+
"@vitest/coverage-v8": "^4.1.4",
|
|
58
60
|
"rimraf": "^6.1.3",
|
|
59
|
-
"
|
|
61
|
+
"tsdown": "^0.21.7",
|
|
60
62
|
"tsx": "^4.21.0",
|
|
61
|
-
"typescript": "
|
|
62
|
-
"vitest": "^4.1.
|
|
63
|
+
"typescript": "6.0.2",
|
|
64
|
+
"vitest": "^4.1.4"
|
|
63
65
|
},
|
|
64
66
|
"dependencies": {
|
|
65
67
|
"@fastify/cookie": "^11.0.2",
|
|
66
68
|
"@fastify/helmet": "^13.0.2",
|
|
67
69
|
"@fastify/rate-limit": "^10.3.0",
|
|
68
|
-
"@fastify/static": "^9.
|
|
70
|
+
"@fastify/static": "^9.1.0",
|
|
69
71
|
"@fastify/swagger": "^9.7.0",
|
|
70
72
|
"@fastify/swagger-ui": "^5.2.5",
|
|
71
|
-
"@scalar/api-reference": "^1.
|
|
73
|
+
"@scalar/api-reference": "^1.52.1",
|
|
72
74
|
"detect-port": "^2.1.0",
|
|
73
|
-
"fastify": "^5.8.
|
|
74
|
-
"hookified": "^2.1.
|
|
75
|
+
"fastify": "^5.8.4",
|
|
76
|
+
"hookified": "^2.1.1",
|
|
75
77
|
"html-escaper": "^3.0.3",
|
|
76
78
|
"pino": "^10.3.1",
|
|
77
79
|
"pino-pretty": "^13.1.3"
|
|
@@ -84,6 +86,14 @@
|
|
|
84
86
|
"pnpm": {
|
|
85
87
|
"overrides": {
|
|
86
88
|
"set-cookie-parser": "2.7.2"
|
|
87
|
-
}
|
|
89
|
+
},
|
|
90
|
+
"onlyBuiltDependencies": [
|
|
91
|
+
"@swc/core",
|
|
92
|
+
"core-js",
|
|
93
|
+
"esbuild",
|
|
94
|
+
"protobufjs",
|
|
95
|
+
"unrs-resolver",
|
|
96
|
+
"vue-demi"
|
|
97
|
+
]
|
|
88
98
|
}
|
|
89
99
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
import { RateLimitPluginOptions } from '@fastify/rate-limit';
|
|
2
|
-
import { FastifyRequest, FastifyInstance } from 'fastify';
|
|
3
|
-
import { Hookified, HookifiedOptions } from 'hookified';
|
|
4
|
-
|
|
5
|
-
type CertificateOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* Common Name for the certificate subject. Defaults to 'localhost'.
|
|
8
|
-
*/
|
|
9
|
-
commonName?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Subject Alternative Names. Defaults to [dns:localhost, ip:127.0.0.1, ip:::1].
|
|
12
|
-
*/
|
|
13
|
-
altNames?: Array<{
|
|
14
|
-
type: "dns";
|
|
15
|
-
value: string;
|
|
16
|
-
} | {
|
|
17
|
-
type: "ip";
|
|
18
|
-
value: string;
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* Number of days the certificate is valid. Defaults to 365.
|
|
22
|
-
*/
|
|
23
|
-
validityDays?: number;
|
|
24
|
-
/**
|
|
25
|
-
* RSA key size in bits. Defaults to 2048.
|
|
26
|
-
*/
|
|
27
|
-
keySize?: number;
|
|
28
|
-
};
|
|
29
|
-
type CertificateResult = {
|
|
30
|
-
/**
|
|
31
|
-
* PEM-encoded X.509 certificate.
|
|
32
|
-
*/
|
|
33
|
-
cert: string;
|
|
34
|
-
/**
|
|
35
|
-
* PEM-encoded PKCS#8 private key.
|
|
36
|
-
*/
|
|
37
|
-
key: string;
|
|
38
|
-
};
|
|
39
|
-
type CertificateFileOptions = CertificateOptions & {
|
|
40
|
-
/**
|
|
41
|
-
* File path to write the certificate PEM.
|
|
42
|
-
*/
|
|
43
|
-
certPath: string;
|
|
44
|
-
/**
|
|
45
|
-
* File path to write the private key PEM.
|
|
46
|
-
*/
|
|
47
|
-
keyPath: string;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Generate a self-signed certificate using only Node.js built-in crypto.
|
|
51
|
-
* Returns PEM-encoded certificate and private key strings.
|
|
52
|
-
*/
|
|
53
|
-
declare function generateCertificate(options?: CertificateOptions): CertificateResult;
|
|
54
|
-
/**
|
|
55
|
-
* Generate a self-signed certificate and write PEM files to disk.
|
|
56
|
-
* Returns the same CertificateResult as generateCertificate().
|
|
57
|
-
*/
|
|
58
|
-
declare function generateCertificateFiles(options: CertificateFileOptions): Promise<CertificateResult>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Configuration for the injected response
|
|
62
|
-
*/
|
|
63
|
-
type InjectionResponse = {
|
|
64
|
-
/**
|
|
65
|
-
* The response body (can be string, object, or buffer)
|
|
66
|
-
*/
|
|
67
|
-
response: string | Record<string, unknown> | Buffer;
|
|
68
|
-
/**
|
|
69
|
-
* HTTP status code for the response
|
|
70
|
-
* @default 200
|
|
71
|
-
*/
|
|
72
|
-
statusCode?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Response headers
|
|
75
|
-
*/
|
|
76
|
-
headers?: Record<string, string | string[]>;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Criteria for matching requests to inject responses
|
|
80
|
-
*/
|
|
81
|
-
type InjectionMatcher = {
|
|
82
|
-
/**
|
|
83
|
-
* URL path to match (supports wildcards with *)
|
|
84
|
-
* @example "/api/users" - exact match
|
|
85
|
-
* @example "/api/*" - wildcard match
|
|
86
|
-
*/
|
|
87
|
-
url?: string;
|
|
88
|
-
/**
|
|
89
|
-
* Hostname to match
|
|
90
|
-
* @example "localhost"
|
|
91
|
-
* @example "api.example.com"
|
|
92
|
-
*/
|
|
93
|
-
hostname?: string;
|
|
94
|
-
/**
|
|
95
|
-
* HTTP method to match
|
|
96
|
-
* @example "GET"
|
|
97
|
-
* @example "POST"
|
|
98
|
-
*/
|
|
99
|
-
method?: string;
|
|
100
|
-
/**
|
|
101
|
-
* Request headers to match (all specified headers must match)
|
|
102
|
-
*/
|
|
103
|
-
headers?: Record<string, string>;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Function that returns an injection response
|
|
107
|
-
*/
|
|
108
|
-
type InjectionResponseFunction = (request: FastifyRequest) => InjectionResponse;
|
|
109
|
-
/**
|
|
110
|
-
* A tap represents an active injection that can be removed later
|
|
111
|
-
*/
|
|
112
|
-
type InjectionTap = {
|
|
113
|
-
/**
|
|
114
|
-
* Unique identifier for this injection
|
|
115
|
-
*/
|
|
116
|
-
id: string;
|
|
117
|
-
/**
|
|
118
|
-
* The response configuration or a function that returns it
|
|
119
|
-
*/
|
|
120
|
-
response: InjectionResponse | InjectionResponseFunction;
|
|
121
|
-
/**
|
|
122
|
-
* The request matcher configuration
|
|
123
|
-
*/
|
|
124
|
-
matcher?: InjectionMatcher;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Manages HTTP response injections for testing and mocking
|
|
128
|
-
*/
|
|
129
|
-
declare class TapManager {
|
|
130
|
-
private _injections;
|
|
131
|
-
constructor();
|
|
132
|
-
/**
|
|
133
|
-
* Get all active injection taps
|
|
134
|
-
*/
|
|
135
|
-
get injections(): Map<string, InjectionTap>;
|
|
136
|
-
/**
|
|
137
|
-
* Check if there are any active injections
|
|
138
|
-
*/
|
|
139
|
-
get hasInjections(): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Inject a custom response for requests matching the given criteria
|
|
142
|
-
* @param response - The response configuration or a function that returns it
|
|
143
|
-
* @param matcher - Optional criteria to match requests
|
|
144
|
-
* @returns A tap object that can be used to remove the injection
|
|
145
|
-
*/
|
|
146
|
-
inject(response: InjectionResponse | InjectionResponseFunction, matcher?: InjectionMatcher): InjectionTap;
|
|
147
|
-
/**
|
|
148
|
-
* Remove an injection by its tap object or ID
|
|
149
|
-
* @param tapOrId - The tap object or tap ID to remove
|
|
150
|
-
* @returns true if the injection was removed, false if it wasn't found
|
|
151
|
-
*/
|
|
152
|
-
removeInjection(tapOrId: InjectionTap | string): boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Find the first injection that matches the given request
|
|
155
|
-
* @param request - The Fastify request object
|
|
156
|
-
* @returns The matching injection tap, or undefined if no match
|
|
157
|
-
*/
|
|
158
|
-
matchRequest(request: FastifyRequest): InjectionTap | undefined;
|
|
159
|
-
/**
|
|
160
|
-
* Clear all injections
|
|
161
|
-
*/
|
|
162
|
-
clear(): void;
|
|
163
|
-
/**
|
|
164
|
-
* Check if a request matches the given matcher criteria
|
|
165
|
-
* @param request - The Fastify request object
|
|
166
|
-
* @param matcher - The matcher criteria (undefined matches all requests)
|
|
167
|
-
* @returns true if the request matches
|
|
168
|
-
*/
|
|
169
|
-
private requestMatches;
|
|
170
|
-
/**
|
|
171
|
-
* Check if a URL matches a pattern (supports wildcards with *)
|
|
172
|
-
* @param url - The URL to test
|
|
173
|
-
* @param pattern - The pattern to match against
|
|
174
|
-
* @returns true if the URL matches the pattern
|
|
175
|
-
*/
|
|
176
|
-
private urlMatches;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
type HttpBinOptions = {
|
|
180
|
-
httpMethods?: boolean;
|
|
181
|
-
redirects?: boolean;
|
|
182
|
-
requestInspection?: boolean;
|
|
183
|
-
responseInspection?: boolean;
|
|
184
|
-
statusCodes?: boolean;
|
|
185
|
-
responseFormats?: boolean;
|
|
186
|
-
cookies?: boolean;
|
|
187
|
-
anything?: boolean;
|
|
188
|
-
auth?: boolean;
|
|
189
|
-
images?: boolean;
|
|
190
|
-
dynamicData?: boolean;
|
|
191
|
-
};
|
|
192
|
-
type HttpsOptions = {
|
|
193
|
-
/**
|
|
194
|
-
* PEM-encoded certificate string, or file path to a certificate PEM file.
|
|
195
|
-
*/
|
|
196
|
-
cert?: string;
|
|
197
|
-
/**
|
|
198
|
-
* PEM-encoded private key string, or file path to a private key PEM file.
|
|
199
|
-
*/
|
|
200
|
-
key?: string;
|
|
201
|
-
/**
|
|
202
|
-
* If true, auto-generate a self-signed certificate. Defaults to true when no cert/key provided.
|
|
203
|
-
*/
|
|
204
|
-
autoGenerate?: boolean;
|
|
205
|
-
/**
|
|
206
|
-
* Options for auto-generating a self-signed certificate. Only used when auto-generating.
|
|
207
|
-
*/
|
|
208
|
-
certificateOptions?: CertificateOptions;
|
|
209
|
-
};
|
|
210
|
-
type MockHttpOptions = {
|
|
211
|
-
/**
|
|
212
|
-
* The port to listen on. If not provided, defaults to 3000 and detects the next available port if in use.
|
|
213
|
-
*/
|
|
214
|
-
port?: number;
|
|
215
|
-
/**
|
|
216
|
-
* The host to listen on. If not provided, defaults to '0.0.0.0'.
|
|
217
|
-
*/
|
|
218
|
-
host?: string;
|
|
219
|
-
/**
|
|
220
|
-
* Whether to automatically detect the next available port if the provided port is in use. Defaults
|
|
221
|
-
* to true.
|
|
222
|
-
*/
|
|
223
|
-
autoDetectPort?: boolean;
|
|
224
|
-
/**
|
|
225
|
-
* Whether to use Helmet for security headers. Defaults to true.
|
|
226
|
-
*/
|
|
227
|
-
helmet?: boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Whether to use Swagger for API documentation. Defaults to true.
|
|
230
|
-
*/
|
|
231
|
-
apiDocs?: boolean;
|
|
232
|
-
/**
|
|
233
|
-
* Whether to use Swagger UI. Defaults to true.
|
|
234
|
-
*/
|
|
235
|
-
httpBin?: HttpBinOptions;
|
|
236
|
-
/**
|
|
237
|
-
* Rate limiting options. Defaults to 1000 requests per minute (localhost excluded).
|
|
238
|
-
* Set to undefined to disable rate limiting, or provide custom options to configure.
|
|
239
|
-
*/
|
|
240
|
-
rateLimit?: boolean | RateLimitPluginOptions;
|
|
241
|
-
/**
|
|
242
|
-
* Hookified options.
|
|
243
|
-
*/
|
|
244
|
-
hookOptions?: HookifiedOptions;
|
|
245
|
-
/**
|
|
246
|
-
* Whether to enable logging. Defaults to true.
|
|
247
|
-
*/
|
|
248
|
-
logging?: boolean;
|
|
249
|
-
/**
|
|
250
|
-
* HTTPS configuration. Set to true to auto-generate a self-signed certificate,
|
|
251
|
-
* or provide an object with cert/key strings/paths or auto-generation options.
|
|
252
|
-
*/
|
|
253
|
-
https?: boolean | HttpsOptions;
|
|
254
|
-
/**
|
|
255
|
-
* Whether to enable HTTP/2 support. When used with `https`, enables h2 (HTTP/2 over TLS).
|
|
256
|
-
* When used without `https`, enables h2c (HTTP/2 cleartext).
|
|
257
|
-
* Defaults to false.
|
|
258
|
-
*/
|
|
259
|
-
http2?: boolean;
|
|
260
|
-
/**
|
|
261
|
-
* Whether to allow HTTP/1.1 fallback when using HTTP/2 with HTTPS (ALPN negotiation).
|
|
262
|
-
* Only applies when both `http2` and `https` are enabled.
|
|
263
|
-
* Defaults to true.
|
|
264
|
-
*/
|
|
265
|
-
http1?: boolean;
|
|
266
|
-
};
|
|
267
|
-
declare class MockHttp extends Hookified {
|
|
268
|
-
private _port;
|
|
269
|
-
private _host;
|
|
270
|
-
private _autoDetectPort;
|
|
271
|
-
private _helmet;
|
|
272
|
-
private _apiDocs;
|
|
273
|
-
private _logging;
|
|
274
|
-
private _httpBin;
|
|
275
|
-
private _rateLimit?;
|
|
276
|
-
private _http2;
|
|
277
|
-
private _http1;
|
|
278
|
-
private _https;
|
|
279
|
-
private _httpsCredentials;
|
|
280
|
-
private _server;
|
|
281
|
-
private _taps;
|
|
282
|
-
constructor(options?: MockHttpOptions);
|
|
283
|
-
/**
|
|
284
|
-
* The port to listen on. If not provided, defaults to 3000 and detects the next available port if in use.
|
|
285
|
-
* @default 3000
|
|
286
|
-
*/
|
|
287
|
-
get port(): number;
|
|
288
|
-
/**
|
|
289
|
-
* The port to listen on. If not provided, defaults to 3000 and detects the next available port if in use.
|
|
290
|
-
* @default 3000
|
|
291
|
-
*/
|
|
292
|
-
set port(port: number);
|
|
293
|
-
/**
|
|
294
|
-
* The host to listen on. If not provided, defaults to 'localhost'.
|
|
295
|
-
* @default 'localhost'
|
|
296
|
-
*/
|
|
297
|
-
get host(): string;
|
|
298
|
-
/**
|
|
299
|
-
* The host to listen on. If not provided, defaults to 'localhost'.
|
|
300
|
-
* @default 'localhost'
|
|
301
|
-
*/
|
|
302
|
-
set host(host: string);
|
|
303
|
-
/**
|
|
304
|
-
* Whether to automatically detect the next available port if the provided port is in use. Defaults to true.
|
|
305
|
-
* @default true
|
|
306
|
-
*/
|
|
307
|
-
get autoDetectPort(): boolean;
|
|
308
|
-
/**
|
|
309
|
-
* Whether to automatically detect the next available port if the provided port is in use. Defaults to true.
|
|
310
|
-
* @default true
|
|
311
|
-
*/
|
|
312
|
-
set autoDetectPort(autoDetectPort: boolean);
|
|
313
|
-
/**
|
|
314
|
-
* Whether to use Helmet for security headers. Defaults to true.
|
|
315
|
-
* @default true
|
|
316
|
-
*/
|
|
317
|
-
get helmet(): boolean;
|
|
318
|
-
/**
|
|
319
|
-
* Whether to use Helmet for security headers. Defaults to true.
|
|
320
|
-
* @default true
|
|
321
|
-
*/
|
|
322
|
-
set helmet(helmet: boolean);
|
|
323
|
-
/**
|
|
324
|
-
* Whether to use Swagger for API documentation. Defaults to true.
|
|
325
|
-
* @default true
|
|
326
|
-
*/
|
|
327
|
-
get apiDocs(): boolean;
|
|
328
|
-
/**
|
|
329
|
-
* Whether to use Swagger for API documentation. Defaults to true.
|
|
330
|
-
* @default true
|
|
331
|
-
*/
|
|
332
|
-
set apiDocs(apiDocs: boolean);
|
|
333
|
-
/**
|
|
334
|
-
* Whether to enable logging. Defaults to true.
|
|
335
|
-
* @default true
|
|
336
|
-
*/
|
|
337
|
-
get logging(): boolean;
|
|
338
|
-
/**
|
|
339
|
-
* Whether to enable logging. Defaults to true.
|
|
340
|
-
* @default true
|
|
341
|
-
*/
|
|
342
|
-
set logging(logging: boolean);
|
|
343
|
-
/**
|
|
344
|
-
* HTTPS configuration. Set to true to auto-generate a self-signed certificate,
|
|
345
|
-
* or provide an HttpsOptions object with cert/key or auto-generation options.
|
|
346
|
-
*/
|
|
347
|
-
get https(): HttpsOptions | undefined;
|
|
348
|
-
/**
|
|
349
|
-
* HTTPS configuration. Set to true to auto-generate a self-signed certificate,
|
|
350
|
-
* or provide an HttpsOptions object with cert/key or auto-generation options.
|
|
351
|
-
*/
|
|
352
|
-
set https(value: boolean | HttpsOptions | undefined);
|
|
353
|
-
/**
|
|
354
|
-
* Whether the server is running in HTTPS mode.
|
|
355
|
-
*/
|
|
356
|
-
get isHttps(): boolean;
|
|
357
|
-
/**
|
|
358
|
-
* Whether HTTP/2 support is enabled.
|
|
359
|
-
* @default false
|
|
360
|
-
*/
|
|
361
|
-
get http2(): boolean;
|
|
362
|
-
/**
|
|
363
|
-
* Whether HTTP/2 support is enabled.
|
|
364
|
-
* @default false
|
|
365
|
-
*/
|
|
366
|
-
set http2(http2: boolean);
|
|
367
|
-
/**
|
|
368
|
-
* Whether to allow HTTP/1.1 fallback when using HTTP/2 with HTTPS.
|
|
369
|
-
* @default true
|
|
370
|
-
*/
|
|
371
|
-
get http1(): boolean;
|
|
372
|
-
/**
|
|
373
|
-
* Whether to allow HTTP/1.1 fallback when using HTTP/2 with HTTPS.
|
|
374
|
-
* @default true
|
|
375
|
-
*/
|
|
376
|
-
set http1(http1: boolean);
|
|
377
|
-
/**
|
|
378
|
-
* HTTP Bin options. Defaults to all enabled.
|
|
379
|
-
*/
|
|
380
|
-
get httpBin(): HttpBinOptions;
|
|
381
|
-
/**
|
|
382
|
-
* HTTP Bin options. Defaults to all enabled.
|
|
383
|
-
*/
|
|
384
|
-
set httpBin(httpBinary: HttpBinOptions);
|
|
385
|
-
/**
|
|
386
|
-
* Rate limiting options. Defaults to 1000 requests per minute (localhost excluded).
|
|
387
|
-
* Set to undefined to disable rate limiting, or provide custom options to configure.
|
|
388
|
-
* @default { max: 1000, timeWindow: "1 minute", allowList: ["127.0.0.1", "::1"] }
|
|
389
|
-
*/
|
|
390
|
-
get rateLimit(): RateLimitPluginOptions | undefined;
|
|
391
|
-
/**
|
|
392
|
-
* Rate limiting options. Defaults to 1000 requests per minute (localhost excluded).
|
|
393
|
-
* Set to undefined to disable rate limiting, or provide custom options to configure.
|
|
394
|
-
*
|
|
395
|
-
* Note: Changing this property requires restarting the server (close() then start()) for changes to take effect.
|
|
396
|
-
* @default { max: 1000, timeWindow: "1 minute", allowList: ["127.0.0.1", "::1"] }
|
|
397
|
-
*/
|
|
398
|
-
set rateLimit(rateLimit: RateLimitPluginOptions | undefined);
|
|
399
|
-
/**
|
|
400
|
-
* The Fastify server instance.
|
|
401
|
-
*/
|
|
402
|
-
get server(): FastifyInstance;
|
|
403
|
-
/**
|
|
404
|
-
* The Fastify server instance.
|
|
405
|
-
*/
|
|
406
|
-
set server(server: FastifyInstance);
|
|
407
|
-
/**
|
|
408
|
-
* The TapManager instance for managing injection taps.
|
|
409
|
-
*/
|
|
410
|
-
get taps(): TapManager;
|
|
411
|
-
/**
|
|
412
|
-
* The TapManager instance for managing injection taps.
|
|
413
|
-
*/
|
|
414
|
-
set taps(taps: TapManager);
|
|
415
|
-
/**
|
|
416
|
-
* Start the Fastify server. If the server is already running, it will be closed and restarted.
|
|
417
|
-
*/
|
|
418
|
-
start(): Promise<void>;
|
|
419
|
-
/**
|
|
420
|
-
* Close the Fastify server.
|
|
421
|
-
*/
|
|
422
|
-
close(): Promise<void>;
|
|
423
|
-
/**
|
|
424
|
-
* Detect the next available port to run on.
|
|
425
|
-
* @returns The port that is available to run on
|
|
426
|
-
*/
|
|
427
|
-
detectPort(): Promise<number>;
|
|
428
|
-
/**
|
|
429
|
-
* This will register the API documentation routes including openapi and swagger ui.
|
|
430
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
431
|
-
*/
|
|
432
|
-
registerApiDocs(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
433
|
-
/**
|
|
434
|
-
* Register the HTTP methods routes.
|
|
435
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
436
|
-
*/
|
|
437
|
-
registerHttpMethods(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
438
|
-
/**
|
|
439
|
-
* Register the status code routes.
|
|
440
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
441
|
-
*/
|
|
442
|
-
registerStatusCodeRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
443
|
-
/**
|
|
444
|
-
* Register the request inspection routes.
|
|
445
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
446
|
-
*/
|
|
447
|
-
registerRequestInspectionRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
448
|
-
/**
|
|
449
|
-
* Register the response inspection routes.
|
|
450
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
451
|
-
*/
|
|
452
|
-
registerResponseInspectionRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
453
|
-
registerResponseFormatRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
454
|
-
/**
|
|
455
|
-
* Register the redirect routes.
|
|
456
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
457
|
-
*/
|
|
458
|
-
registerRedirectRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
459
|
-
/**
|
|
460
|
-
* Register the cookie routes.
|
|
461
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
462
|
-
*/
|
|
463
|
-
registerCookieRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
464
|
-
/**
|
|
465
|
-
* Register the anything routes.
|
|
466
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
467
|
-
*/
|
|
468
|
-
registerAnythingRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
469
|
-
/**
|
|
470
|
-
* Register the auth routes.
|
|
471
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
472
|
-
*/
|
|
473
|
-
registerAuthRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
474
|
-
/**
|
|
475
|
-
* Register the image routes.
|
|
476
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
477
|
-
*/
|
|
478
|
-
registerImageRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
479
|
-
/**
|
|
480
|
-
* Register the dynamic data routes.
|
|
481
|
-
* @param fastifyInstance - the server instance to register the routes on.
|
|
482
|
-
*/
|
|
483
|
-
registerDynamicDataRoutes(fastifyInstance?: FastifyInstance): Promise<void>;
|
|
484
|
-
private resolveHttpsCredentials;
|
|
485
|
-
private loadPemValue;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
declare const start: () => Promise<MockHttp>;
|
|
489
|
-
|
|
490
|
-
export { type CertificateFileOptions, type CertificateOptions, type CertificateResult, type HttpsOptions, type InjectionMatcher, type InjectionResponse, type InjectionTap, MockHttp as default, generateCertificate, generateCertificateFiles, MockHttp as mockhttp, start };
|