@h3ravel/http 11.5.3 → 11.6.1
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/dist/app.globals.d.ts +5 -1
- package/dist/{find-up-simple-CPevfdC2.cjs → find-up-simple-C7LasaJE.cjs} +0 -1
- package/dist/index.cjs +4708 -2933
- package/dist/index.d.ts +1272 -432
- package/dist/index.js +4804 -3018
- package/package.json +8 -8
- package/dist/index.d.cts +0 -1057
package/dist/index.d.ts
CHANGED
|
@@ -1,177 +1,58 @@
|
|
|
1
1
|
/// <reference path="./app.globals.d.ts" />
|
|
2
2
|
import { Command } from "@h3ravel/musket";
|
|
3
|
-
import {
|
|
3
|
+
import { DateTime } from "@h3ravel/support";
|
|
4
4
|
import { EventHandlerRequest, H3Event, HTTPResponse } from "h3";
|
|
5
|
+
import { DotNestedKeys, DotNestedValue, HttpContext as HttpContext$1, IApplication, IMiddleware, IParamBag, IRequest, IResponse, RequestMethod, RequestObject, ResponseObject } from "@h3ravel/shared";
|
|
5
6
|
import { Application } from "@h3ravel/core";
|
|
6
7
|
import { Url } from "@h3ravel/url";
|
|
7
8
|
|
|
8
|
-
//#region src/
|
|
9
|
-
|
|
10
|
-
type RequestObject = Record<string, any>;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/Bags/ParamBag.d.ts
|
|
13
|
-
/**
|
|
14
|
-
* ParamBag is a container for key/value pairs
|
|
15
|
-
* for Node/H3 environments.
|
|
16
|
-
*/
|
|
17
|
-
declare class ParamBag implements Iterable<[string, any]> {
|
|
18
|
-
protected parameters: RequestObject;
|
|
19
|
-
/**
|
|
20
|
-
* The current H3 H3Event instance
|
|
21
|
-
*/
|
|
22
|
-
readonly event: H3Event;
|
|
23
|
-
constructor(parameters: RequestObject | undefined,
|
|
24
|
-
/**
|
|
25
|
-
* The current H3 H3Event instance
|
|
26
|
-
*/
|
|
27
|
-
event: H3Event);
|
|
28
|
-
/**
|
|
29
|
-
* Returns the parameters.
|
|
30
|
-
* @
|
|
31
|
-
* @param key The name of the parameter to return or null to get them all
|
|
32
|
-
*
|
|
33
|
-
* @throws BadRequestException if the value is not an array
|
|
34
|
-
*/
|
|
35
|
-
all(key?: string): any;
|
|
36
|
-
get(key: string, defaultValue?: any): any;
|
|
37
|
-
set(key: string, value: any): void;
|
|
38
|
-
/**
|
|
39
|
-
* Returns true if the parameter is defined.
|
|
40
|
-
*
|
|
41
|
-
* @param key
|
|
42
|
-
*/
|
|
43
|
-
has(key: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Removes a parameter.
|
|
46
|
-
*
|
|
47
|
-
* @param key
|
|
48
|
-
*/
|
|
49
|
-
remove(key: string): void;
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* Returns the parameter as string.
|
|
53
|
-
*
|
|
54
|
-
* @param key
|
|
55
|
-
* @param defaultValue
|
|
56
|
-
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
getString(key: string, defaultValue?: string): string;
|
|
60
|
-
/**
|
|
61
|
-
* Returns the parameter value converted to integer.
|
|
62
|
-
*
|
|
63
|
-
* @param key
|
|
64
|
-
* @param defaultValue
|
|
65
|
-
* @throws UnexpectedValueException if the value cannot be converted to integer
|
|
66
|
-
*/
|
|
67
|
-
getInt(key: string, defaultValue?: number): number;
|
|
68
|
-
/**
|
|
69
|
-
* Returns the parameter value converted to boolean.
|
|
70
|
-
*
|
|
71
|
-
* @param key
|
|
72
|
-
* @param defaultValue
|
|
73
|
-
* @throws UnexpectedValueException if the value cannot be converted to a boolean
|
|
74
|
-
*/
|
|
75
|
-
getBoolean(key: string, defaultValue?: boolean): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Returns the alphabetic characters of the parameter value.
|
|
78
|
-
*
|
|
79
|
-
* @param key
|
|
80
|
-
* @param defaultValue
|
|
81
|
-
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
82
|
-
*/
|
|
83
|
-
getAlpha(key: string, defaultValue?: string): string;
|
|
84
|
-
/**
|
|
85
|
-
* Returns the alphabetic characters and digits of the parameter value.
|
|
86
|
-
*
|
|
87
|
-
* @param key
|
|
88
|
-
* @param defaultValue
|
|
89
|
-
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
90
|
-
*/
|
|
91
|
-
getAlnum(key: string, defaultValue?: string): string;
|
|
9
|
+
//#region src/Commands/FireCommand.d.ts
|
|
10
|
+
declare class FireCommand extends Command {
|
|
92
11
|
/**
|
|
93
|
-
*
|
|
12
|
+
* The name and signature of the console command.
|
|
94
13
|
*
|
|
95
|
-
* @
|
|
96
|
-
* @param defaultValue
|
|
97
|
-
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
98
|
-
* @returns
|
|
99
|
-
**/
|
|
100
|
-
getDigits(key: string, defaultValue?: string): string;
|
|
101
|
-
/**
|
|
102
|
-
* Returns the parameter keys.
|
|
103
|
-
*/
|
|
104
|
-
keys(): string[];
|
|
105
|
-
/**
|
|
106
|
-
* Replaces the current parameters by a new set.
|
|
107
|
-
*/
|
|
108
|
-
replace(parameters?: RequestObject): void;
|
|
109
|
-
/**
|
|
110
|
-
* Adds parameters.
|
|
111
|
-
*/
|
|
112
|
-
add(parameters?: RequestObject): void;
|
|
113
|
-
/**
|
|
114
|
-
* Returns the number of parameters.
|
|
14
|
+
* @var string
|
|
115
15
|
*/
|
|
116
|
-
|
|
16
|
+
protected signature: string;
|
|
117
17
|
/**
|
|
118
|
-
*
|
|
18
|
+
* The console command description.
|
|
119
19
|
*
|
|
120
|
-
* @
|
|
20
|
+
* @var string
|
|
121
21
|
*/
|
|
122
|
-
|
|
22
|
+
protected description: string;
|
|
23
|
+
handle(): Promise<void>;
|
|
24
|
+
protected fire(): Promise<void>;
|
|
123
25
|
}
|
|
124
26
|
//#endregion
|
|
125
|
-
//#region src/
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
27
|
+
//#region src/Contracts/HttpContract.d.ts
|
|
28
|
+
type CacheOptions = Partial<{
|
|
29
|
+
must_revalidate: boolean;
|
|
30
|
+
no_cache: boolean;
|
|
31
|
+
no_store: boolean;
|
|
32
|
+
no_transform: boolean;
|
|
33
|
+
public: boolean;
|
|
34
|
+
private: boolean;
|
|
35
|
+
proxy_revalidate: boolean;
|
|
36
|
+
max_age: number;
|
|
37
|
+
s_maxage: number;
|
|
38
|
+
immutable: boolean;
|
|
39
|
+
stale_while_revalidate: number;
|
|
40
|
+
stale_if_error: number;
|
|
41
|
+
last_modified: string | Date;
|
|
42
|
+
etag: string;
|
|
43
|
+
}>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/Exceptions/BadRequestException.d.ts
|
|
46
|
+
declare class BadRequestException extends Error {
|
|
47
|
+
constructor(message: string);
|
|
137
48
|
}
|
|
138
49
|
//#endregion
|
|
139
|
-
//#region src/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* FileBag is a container for uploaded files
|
|
143
|
-
* for Node/H3 environments.
|
|
144
|
-
*/
|
|
145
|
-
declare class FileBag extends ParamBag {
|
|
146
|
-
protected parameters: Record<string, UploadedFile | UploadedFile[] | null>;
|
|
147
|
-
constructor(parameters: Record<string, FileInput | FileInput[]> | undefined,
|
|
148
|
-
/**
|
|
149
|
-
* The current H3 H3Event instance
|
|
150
|
-
*/
|
|
151
|
-
event: H3Event);
|
|
152
|
-
/**
|
|
153
|
-
* Replace all stored files.
|
|
154
|
-
*/
|
|
155
|
-
replace(files?: Record<string, FileInput | FileInput[]>): void;
|
|
156
|
-
/**
|
|
157
|
-
* Set a file or array of files.
|
|
158
|
-
*/
|
|
159
|
-
set(key: string, value: FileInput | FileInput[]): void;
|
|
160
|
-
/**
|
|
161
|
-
* Add multiple files.
|
|
162
|
-
*/
|
|
163
|
-
add(files?: Record<string, FileInput | FileInput[]>): void;
|
|
164
|
-
/**
|
|
165
|
-
* Get all stored files.
|
|
166
|
-
*/
|
|
167
|
-
all(): Record<string, UploadedFile | UploadedFile[] | null>;
|
|
168
|
-
/**
|
|
169
|
-
* Normalize file input into UploadedFile instances.
|
|
170
|
-
*/
|
|
171
|
-
protected convertFileInformation(file: FileInput): UploadedFile | null;
|
|
50
|
+
//#region src/Exceptions/ConflictingHeadersException.d.ts
|
|
51
|
+
declare class ConflictingHeadersException extends Error {
|
|
52
|
+
constructor(message: string);
|
|
172
53
|
}
|
|
173
54
|
//#endregion
|
|
174
|
-
//#region src/
|
|
55
|
+
//#region src/Utilities/HeaderBag.d.ts
|
|
175
56
|
/**
|
|
176
57
|
* HeaderBag — A container for HTTP headers
|
|
177
58
|
* for Node/H3 environments.
|
|
@@ -180,6 +61,7 @@ declare class HeaderBag implements Iterable<[string, (string | null)[]]> {
|
|
|
180
61
|
protected static readonly UPPER = "_ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
181
62
|
protected static readonly LOWER = "-abcdefghijklmnopqrstuvwxyz";
|
|
182
63
|
protected headers: Record<string, (string | null)[]>;
|
|
64
|
+
protected headerNames: Record<string, string>;
|
|
183
65
|
protected cacheControl: Record<string, string | boolean>;
|
|
184
66
|
constructor(headers?: Record<string, string | string[] | null>);
|
|
185
67
|
/**
|
|
@@ -194,7 +76,7 @@ declare class HeaderBag implements Iterable<[string, (string | null)[]]> {
|
|
|
194
76
|
* @param key
|
|
195
77
|
* @returns
|
|
196
78
|
*/
|
|
197
|
-
all(key?:
|
|
79
|
+
all<K extends string | undefined>(key?: K): K extends string ? (string | null)[] : Record<string, (string | null)[]>;
|
|
198
80
|
/**
|
|
199
81
|
* Returns header keys
|
|
200
82
|
*
|
|
@@ -255,7 +137,7 @@ declare class HeaderBag implements Iterable<[string, (string | null)[]]> {
|
|
|
255
137
|
* @param defaultValue
|
|
256
138
|
* @returns
|
|
257
139
|
*/
|
|
258
|
-
getDate(key: string, defaultValue?: Date | null):
|
|
140
|
+
getDate(key: string, defaultValue?: Date | null): DateTime | undefined;
|
|
259
141
|
/**
|
|
260
142
|
* Adds a Cache-Control directive
|
|
261
143
|
*
|
|
@@ -319,163 +201,455 @@ declare class HeaderBag implements Iterable<[string, (string | null)[]]> {
|
|
|
319
201
|
[Symbol.iterator](): Iterator<[string, (string | null)[]]>;
|
|
320
202
|
}
|
|
321
203
|
//#endregion
|
|
322
|
-
//#region src/
|
|
204
|
+
//#region src/Utilities/Cookie.d.ts
|
|
323
205
|
/**
|
|
324
|
-
*
|
|
325
|
-
|
|
206
|
+
* Represents a Cookie
|
|
207
|
+
*/
|
|
208
|
+
declare class Cookie {
|
|
209
|
+
private name;
|
|
210
|
+
private value?;
|
|
211
|
+
private domain?;
|
|
212
|
+
private secure?;
|
|
213
|
+
private httpOnly;
|
|
214
|
+
static readonly SAMESITE_NONE = "none";
|
|
215
|
+
static readonly SAMESITE_LAX = "lax";
|
|
216
|
+
static readonly SAMESITE_STRICT = "strict";
|
|
217
|
+
private expire;
|
|
218
|
+
private path;
|
|
219
|
+
private sameSite?;
|
|
220
|
+
private raw;
|
|
221
|
+
private partitioned;
|
|
222
|
+
private secureDefault;
|
|
223
|
+
private static readonly RESERVED_CHARS_LIST;
|
|
224
|
+
private static readonly RESERVED_CHARS_FROM;
|
|
225
|
+
private static readonly RESERVED_CHARS_TO;
|
|
226
|
+
constructor(name: string, value?: string | null | undefined, expire?: number | string | Date, path?: string, domain?: string | null | undefined, secure?: boolean | null | undefined, httpOnly?: boolean, raw?: boolean, sameSite?: string | null, partitioned?: boolean);
|
|
227
|
+
/**
|
|
228
|
+
* Create a Cookie instance from a Set-Cookie header string.
|
|
229
|
+
*/
|
|
230
|
+
static fromString(cookie: string, decode?: boolean): Cookie;
|
|
231
|
+
/**
|
|
232
|
+
* Convert various expiration formats into a timestamp (seconds)
|
|
233
|
+
*/
|
|
234
|
+
private static expiresTimestamp;
|
|
235
|
+
private clone;
|
|
236
|
+
withValue(value: string | null): Cookie;
|
|
237
|
+
withDomain(domain: string | null): Cookie;
|
|
238
|
+
withPath(path: string | null): Cookie;
|
|
239
|
+
withSecure(secure?: boolean): Cookie;
|
|
240
|
+
withHttpOnly(httpOnly?: boolean): Cookie;
|
|
241
|
+
withRaw(raw?: boolean): Cookie;
|
|
242
|
+
withSameSite(sameSite?: string | null): Cookie;
|
|
243
|
+
withPartitioned(partitioned?: boolean): Cookie;
|
|
244
|
+
withExpires(expire: number | string | Date): Cookie;
|
|
245
|
+
getName(): string;
|
|
246
|
+
getValue(): string | undefined | null;
|
|
247
|
+
getDomain(): string | undefined | null;
|
|
248
|
+
getPath(): string;
|
|
249
|
+
getExpiresTime(): number;
|
|
250
|
+
getMaxAge(): number;
|
|
251
|
+
/**
|
|
252
|
+
* Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client.
|
|
253
|
+
*/
|
|
254
|
+
isSecure(): boolean;
|
|
255
|
+
isHttpOnly(): boolean;
|
|
256
|
+
isRaw(): boolean;
|
|
257
|
+
getSameSite(): string | undefined | null;
|
|
258
|
+
isPartitioned(): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Whether this cookie is about to be cleared.
|
|
261
|
+
*/
|
|
262
|
+
isCleared(): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Convert the cookie to a Set-Cookie header string.
|
|
265
|
+
*/
|
|
266
|
+
toString(): string;
|
|
267
|
+
/**
|
|
268
|
+
* @param bool $default The default value of the "secure" flag when it is set to null
|
|
269
|
+
*/
|
|
270
|
+
setSecureDefault(defaultValue: boolean): void;
|
|
271
|
+
}
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/Utilities/ResponseHeaderBag.d.ts
|
|
274
|
+
/**
|
|
275
|
+
* ResponseHeaderBag is a container for Response HTTP headers.
|
|
326
276
|
* for Node/H3 environments.
|
|
327
277
|
*/
|
|
328
|
-
declare class
|
|
329
|
-
|
|
278
|
+
declare class ResponseHeaderBag extends HeaderBag {
|
|
279
|
+
static readonly COOKIES_FLAT = "flat";
|
|
280
|
+
static readonly COOKIES_ARRAY = "array";
|
|
281
|
+
static readonly DISPOSITION_ATTACHMENT = "attachment";
|
|
282
|
+
static readonly DISPOSITION_INLINE = "inline";
|
|
283
|
+
protected computedCacheControl: Record<string, string | boolean>;
|
|
284
|
+
protected cookies: Record<string, Record<string, Record<string, Cookie>>>;
|
|
285
|
+
protected headerNames: Record<string, string>;
|
|
286
|
+
constructor(
|
|
330
287
|
/**
|
|
331
288
|
* The current H3 H3Event instance
|
|
332
289
|
*/
|
|
333
290
|
event: H3Event);
|
|
334
291
|
/**
|
|
335
|
-
* Returns
|
|
336
|
-
*
|
|
337
|
-
* @param key
|
|
338
|
-
* @param defaultValue
|
|
339
|
-
* @throws BadRequestException if the input contains a non-scalar value
|
|
340
|
-
* @returns
|
|
292
|
+
* Returns the headers with original capitalizations.
|
|
341
293
|
*/
|
|
342
|
-
|
|
294
|
+
allPreserveCase(): Record<string, string[]>;
|
|
295
|
+
allPreserveCaseWithoutCookies(): Record<string, string[]>;
|
|
296
|
+
replace(headers?: Record<string, string | string[]>): void;
|
|
297
|
+
all<K extends string | undefined>(key?: K): K extends string ? (string | null)[] : Record<string, (string | null)[]>;
|
|
298
|
+
set(key: string, values: string | string[] | null, replace?: boolean): void;
|
|
299
|
+
remove(key: string): void;
|
|
300
|
+
hasCacheControlDirective(key: string): boolean;
|
|
301
|
+
getCacheControlDirective(key: string): boolean | string | null;
|
|
302
|
+
setCookie(cookie: Cookie): void;
|
|
303
|
+
removeCookie(name: string, path?: string, domain?: string | null): void;
|
|
343
304
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* @param inputs
|
|
347
|
-
* @returns
|
|
305
|
+
* @throws {Error} if format is invalid
|
|
348
306
|
*/
|
|
349
|
-
|
|
307
|
+
getCookies(format?: string): Cookie[] | Record<string, any>;
|
|
308
|
+
clearCookie(name: string, path?: string, domain?: string | null, secure?: boolean, httpOnly?: boolean, sameSite?: string | null, partitioned?: boolean): void;
|
|
309
|
+
makeDisposition(disposition: string, filename: string, fallback?: string): string;
|
|
310
|
+
protected computeCacheControlValue(): string;
|
|
311
|
+
private initDate;
|
|
312
|
+
}
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/Utilities/HttpResponse.d.ts
|
|
315
|
+
declare class HttpResponse {
|
|
350
316
|
/**
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* @param inputs
|
|
354
|
-
* @returns
|
|
317
|
+
* The current H3 H3Event instance
|
|
355
318
|
*/
|
|
356
|
-
|
|
319
|
+
protected readonly event: H3Event;
|
|
320
|
+
protected statusCode: number;
|
|
321
|
+
protected headers: ResponseHeaderBag;
|
|
322
|
+
protected content: any;
|
|
323
|
+
protected version: string;
|
|
324
|
+
protected statusText: string;
|
|
325
|
+
protected charset?: string;
|
|
357
326
|
/**
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* @param key
|
|
361
|
-
* @param value
|
|
362
|
-
* @throws TypeError if value is not scalar or array
|
|
363
|
-
* @returns
|
|
327
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
|
364
328
|
*/
|
|
365
|
-
|
|
329
|
+
private HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES;
|
|
366
330
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
* @param key
|
|
370
|
-
* @returns
|
|
331
|
+
* The exception that triggered the error response (if applicable).
|
|
371
332
|
*/
|
|
372
|
-
|
|
333
|
+
exception?: Error;
|
|
373
334
|
/**
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
* @returns
|
|
335
|
+
* Tracks headers already sent in informational responses.
|
|
377
336
|
*/
|
|
378
|
-
|
|
337
|
+
private sentHeaders;
|
|
379
338
|
/**
|
|
380
|
-
*
|
|
339
|
+
* Status codes translation table.
|
|
381
340
|
*
|
|
382
|
-
*
|
|
383
|
-
* @
|
|
384
|
-
*
|
|
385
|
-
*
|
|
341
|
+
* The list of codes is complete according to the
|
|
342
|
+
* @link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml Hypertext Transfer Protocol (HTTP) Status Code Registry
|
|
343
|
+
* (last updated 2021-10-01).
|
|
344
|
+
*
|
|
345
|
+
* Unless otherwise noted, the status code is defined in RFC2616.
|
|
386
346
|
*/
|
|
387
|
-
|
|
347
|
+
static statusTexts: {
|
|
348
|
+
[key: number]: string;
|
|
349
|
+
};
|
|
350
|
+
constructor(
|
|
388
351
|
/**
|
|
389
|
-
*
|
|
390
|
-
* Mimics PHP’s filter_var() in spirit, but simpler.
|
|
391
|
-
*
|
|
392
|
-
* @param key
|
|
393
|
-
* @param defaultValue
|
|
394
|
-
* @param filterFn
|
|
395
|
-
* @throws BadRequestException if validation fails
|
|
396
|
-
* @returns
|
|
352
|
+
* The current H3 H3Event instance
|
|
397
353
|
*/
|
|
398
|
-
|
|
354
|
+
event: H3Event);
|
|
399
355
|
/**
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
* @param key
|
|
403
|
-
* @param EnumClass
|
|
404
|
-
* @param defaultValue
|
|
405
|
-
* @throws BadRequestException if conversion fails
|
|
406
|
-
* @returns
|
|
356
|
+
* Set HTTP status code.
|
|
407
357
|
*/
|
|
408
|
-
|
|
358
|
+
setStatusCode(code: number, text?: string): this;
|
|
409
359
|
/**
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* @param key
|
|
360
|
+
* Retrieves the status code for the current web response.
|
|
413
361
|
*/
|
|
414
|
-
|
|
362
|
+
getStatusCode(): number;
|
|
415
363
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* @returns
|
|
364
|
+
* Sets the response charset.
|
|
419
365
|
*/
|
|
420
|
-
|
|
366
|
+
setCharset(charset: string): this;
|
|
421
367
|
/**
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
* @returns
|
|
368
|
+
* Retrieves the response charset.
|
|
425
369
|
*/
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
//#endregion
|
|
429
|
-
//#region src/Bags/ServerBag.d.ts
|
|
430
|
-
/**
|
|
431
|
-
* ServerBag — a simplified version of Symfony's ServerBag
|
|
432
|
-
* for Node/H3 environments.
|
|
433
|
-
*
|
|
434
|
-
* Responsible for extracting and normalizing HTTP headers
|
|
435
|
-
* from the incoming request.
|
|
436
|
-
*/
|
|
437
|
-
declare class ServerBag extends ParamBag {
|
|
438
|
-
constructor(parameters: Record<string, string | undefined> | undefined,
|
|
370
|
+
getCharset(): string | undefined;
|
|
439
371
|
/**
|
|
440
|
-
*
|
|
372
|
+
* Returns true if the response may safely be kept in a shared (surrogate) cache.
|
|
373
|
+
*
|
|
374
|
+
* Responses marked "private" with an explicit Cache-Control directive are
|
|
375
|
+
* considered uncacheable.
|
|
376
|
+
*
|
|
377
|
+
* Responses with neither a freshness lifetime (Expires, max-age) nor cache
|
|
378
|
+
* validator (Last-Modified, ETag) are considered uncacheable because there is
|
|
379
|
+
* no way to tell when or how to remove them from the cache.
|
|
380
|
+
*
|
|
381
|
+
* Note that RFC 7231 and RFC 7234 possibly allow for a more permissive implementation,
|
|
382
|
+
* for example "status codes that are defined as cacheable by default [...]
|
|
383
|
+
* can be reused by a cache with heuristic expiration unless otherwise indicated"
|
|
384
|
+
* (https://tools.ietf.org/html/rfc7231#section-6.1)
|
|
385
|
+
*
|
|
386
|
+
* @final
|
|
441
387
|
*/
|
|
442
|
-
|
|
388
|
+
isCacheable(): boolean;
|
|
443
389
|
/**
|
|
444
|
-
* Returns
|
|
445
|
-
*
|
|
390
|
+
* Returns true if the response is "fresh".
|
|
391
|
+
*
|
|
392
|
+
* Fresh responses may be served from cache without any interaction with the
|
|
393
|
+
* origin. A response is considered fresh when it includes a Cache-Control/max-age
|
|
394
|
+
* indicator or Expires header and the calculated age is less than the freshness lifetime.
|
|
446
395
|
*/
|
|
447
|
-
|
|
396
|
+
isFresh(): boolean;
|
|
448
397
|
/**
|
|
449
|
-
* Returns
|
|
398
|
+
* Returns true if the response includes headers that can be used to validate
|
|
399
|
+
* the response with the origin server using a conditional GET request.
|
|
450
400
|
*/
|
|
451
|
-
|
|
401
|
+
isValidateable(): boolean;
|
|
452
402
|
/**
|
|
453
|
-
*
|
|
403
|
+
* Sets the response content.
|
|
454
404
|
*/
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
//#endregion
|
|
458
|
-
//#region src/Commands/FireCommand.d.ts
|
|
459
|
-
declare class FireCommand extends Command {
|
|
405
|
+
setContent(content?: any): this;
|
|
460
406
|
/**
|
|
461
|
-
*
|
|
407
|
+
* Gets the current response content.
|
|
408
|
+
*/
|
|
409
|
+
getContent(): any;
|
|
410
|
+
/**
|
|
411
|
+
* Set a header.
|
|
412
|
+
*/
|
|
413
|
+
setHeader(name: string, value: string): this;
|
|
414
|
+
/**
|
|
415
|
+
* Sets the HTTP protocol version (1.0 or 1.1).
|
|
416
|
+
*/
|
|
417
|
+
setProtocolVersion(version: string): this;
|
|
418
|
+
/**
|
|
419
|
+
* Gets the HTTP protocol version.
|
|
420
|
+
*/
|
|
421
|
+
getProtocolVersion(): string;
|
|
422
|
+
/**
|
|
423
|
+
* Marks the response as "private".
|
|
462
424
|
*
|
|
463
|
-
*
|
|
425
|
+
* It makes the response ineligible for serving other clients.
|
|
464
426
|
*/
|
|
465
|
-
|
|
427
|
+
setPrivate(): this;
|
|
466
428
|
/**
|
|
467
|
-
*
|
|
429
|
+
* Marks the response as "public".
|
|
468
430
|
*
|
|
469
|
-
*
|
|
431
|
+
* It makes the response eligible for serving other clients.
|
|
470
432
|
*/
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
433
|
+
setPublic(): this;
|
|
434
|
+
/**
|
|
435
|
+
* Returns the Date header as a DateTime instance.
|
|
436
|
+
* @throws {RuntimeException} When the header is not parseable
|
|
437
|
+
*/
|
|
438
|
+
getDate(): DateTime | undefined;
|
|
439
|
+
/**
|
|
440
|
+
* Returns the age of the response in seconds.
|
|
441
|
+
*
|
|
442
|
+
* @final
|
|
443
|
+
*/
|
|
444
|
+
getAge(): number;
|
|
445
|
+
/**
|
|
446
|
+
* Marks the response stale by setting the Age header to be equal to the maximum age of the response.
|
|
447
|
+
*/
|
|
448
|
+
expire(): this;
|
|
449
|
+
/**
|
|
450
|
+
* Returns the value of the Expires header as a DateTime instance.
|
|
451
|
+
*
|
|
452
|
+
* @final
|
|
453
|
+
*/
|
|
454
|
+
getExpires(): DateTime | undefined;
|
|
455
|
+
/**
|
|
456
|
+
* Returns the number of seconds after the time specified in the response's Date
|
|
457
|
+
* header when the response should no longer be considered fresh.
|
|
458
|
+
*
|
|
459
|
+
* First, it checks for a s-maxage directive, then a max-age directive, and then it falls
|
|
460
|
+
* back on an expires header. It returns null when no maximum age can be established.
|
|
461
|
+
*/
|
|
462
|
+
getMaxAge(): number | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* Sets the number of seconds after which the response should no longer be considered fresh.
|
|
465
|
+
*
|
|
466
|
+
* This method sets the Cache-Control max-age directive.
|
|
467
|
+
*/
|
|
468
|
+
setMaxAge(value: number): this;
|
|
469
|
+
/**
|
|
470
|
+
* Sets the number of seconds after which the response should no longer be returned by shared caches when backend is down.
|
|
471
|
+
*
|
|
472
|
+
* This method sets the Cache-Control stale-if-error directive.
|
|
473
|
+
*/
|
|
474
|
+
setStaleIfError(value: number): this;
|
|
475
|
+
/**
|
|
476
|
+
* Sets the number of seconds after which the response should no longer return stale content by shared caches.
|
|
477
|
+
*
|
|
478
|
+
* This method sets the Cache-Control stale-while-revalidate directive.
|
|
479
|
+
*/
|
|
480
|
+
setStaleWhileRevalidate(value: number): this;
|
|
481
|
+
/**
|
|
482
|
+
* Returns the response's time-to-live in seconds.
|
|
483
|
+
*
|
|
484
|
+
* It returns null when no freshness information is present in the response.
|
|
485
|
+
*
|
|
486
|
+
* When the response's TTL is 0, the response may not be served from cache without first
|
|
487
|
+
* revalidating with the origin.
|
|
488
|
+
*
|
|
489
|
+
* @final
|
|
490
|
+
*/
|
|
491
|
+
getTtl(): number | undefined;
|
|
492
|
+
/**
|
|
493
|
+
* Sets the response's time-to-live for shared caches in seconds.
|
|
494
|
+
*
|
|
495
|
+
* This method adjusts the Cache-Control/s-maxage directive.
|
|
496
|
+
*/
|
|
497
|
+
setTtl(seconds: number): this;
|
|
498
|
+
/**
|
|
499
|
+
* Sets the response's time-to-live for private/client caches in seconds.
|
|
500
|
+
*
|
|
501
|
+
* This method adjusts the Cache-Control/max-age directive.
|
|
502
|
+
*/
|
|
503
|
+
setClientTtl(seconds: number): this;
|
|
504
|
+
/**
|
|
505
|
+
* Sets the number of seconds after which the response should no longer be considered fresh by shared caches.
|
|
506
|
+
*
|
|
507
|
+
* This method sets the Cache-Control s-maxage directive.
|
|
508
|
+
*/
|
|
509
|
+
setSharedMaxAge(value: number): this;
|
|
510
|
+
/**
|
|
511
|
+
* Returns the Last-Modified HTTP header as a DateTime instance.
|
|
512
|
+
*
|
|
513
|
+
* @throws \RuntimeException When the HTTP header is not parseable
|
|
514
|
+
*
|
|
515
|
+
* @final
|
|
516
|
+
*/
|
|
517
|
+
getLastModified(): DateTime | undefined;
|
|
518
|
+
/**
|
|
519
|
+
* Sets the Last-Modified HTTP header with a DateTime instance.
|
|
520
|
+
*
|
|
521
|
+
* Passing null as value will remove the header.
|
|
522
|
+
*
|
|
523
|
+
* @return $this
|
|
524
|
+
*
|
|
525
|
+
* @final
|
|
526
|
+
*/
|
|
527
|
+
setLastModified(date?: DateTime | Date | string): this;
|
|
528
|
+
/**
|
|
529
|
+
* Returns the literal value of the ETag HTTP header.
|
|
530
|
+
*/
|
|
531
|
+
getEtag(): string | null;
|
|
532
|
+
/**
|
|
533
|
+
* Sets the ETag value.
|
|
534
|
+
*
|
|
535
|
+
* @param etag The ETag unique identifier or null to remove the header
|
|
536
|
+
* @param weak Whether you want a weak ETag or not
|
|
537
|
+
*/
|
|
538
|
+
setEtag(etag?: string, weak?: boolean): this;
|
|
539
|
+
/**
|
|
540
|
+
* Sets the response's cache headers (validation and/or expiration).
|
|
541
|
+
*
|
|
542
|
+
* Available options are: must_revalidate, no_cache, no_store, no_transform, public, private, proxy_revalidate, max_age, s_maxage, immutable, last_modified and etag.
|
|
543
|
+
*
|
|
544
|
+
* @throws {InvalidArgumentException}
|
|
545
|
+
*/
|
|
546
|
+
setCache(options: CacheOptions): this;
|
|
547
|
+
/**
|
|
548
|
+
* Modifies the response so that it conforms to the rules defined for a 304 status code.
|
|
549
|
+
*
|
|
550
|
+
* This sets the status, removes the body, and discards any headers
|
|
551
|
+
* that MUST NOT be included in 304 responses.
|
|
552
|
+
* @see https://tools.ietf.org/html/rfc2616#section-10.3.5
|
|
553
|
+
*/
|
|
554
|
+
setNotModified(): this;
|
|
555
|
+
/**
|
|
556
|
+
* Add an array of headers to the response.
|
|
557
|
+
*
|
|
558
|
+
*/
|
|
559
|
+
withHeaders(headers: HeaderBag | ResponseObject): this;
|
|
560
|
+
/**
|
|
561
|
+
* Set the exception to attach to the response.
|
|
562
|
+
*/
|
|
563
|
+
withException(e: Error): this;
|
|
564
|
+
/**
|
|
565
|
+
* Throws the response in a HttpResponseException instance.
|
|
566
|
+
*
|
|
567
|
+
* @throws {HttpResponseException}
|
|
568
|
+
*/
|
|
569
|
+
throwResponse(): void;
|
|
570
|
+
/**
|
|
571
|
+
* Is response invalid?
|
|
572
|
+
*
|
|
573
|
+
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
|
574
|
+
*/
|
|
575
|
+
isInvalid(): boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Is response informative?
|
|
578
|
+
*/
|
|
579
|
+
isInformational(): boolean;
|
|
580
|
+
/**
|
|
581
|
+
* Is response successful?
|
|
582
|
+
*/
|
|
583
|
+
isSuccessful(): boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Is the response a redirect?
|
|
586
|
+
*/
|
|
587
|
+
isRedirection(): boolean;
|
|
588
|
+
/**
|
|
589
|
+
* Is there a client error?
|
|
590
|
+
*/
|
|
591
|
+
isClientError(): boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Was there a server side error?
|
|
594
|
+
*/
|
|
595
|
+
isServerError(): boolean;
|
|
596
|
+
/**
|
|
597
|
+
* Is the response OK?
|
|
598
|
+
*/
|
|
599
|
+
isOk(): boolean;
|
|
600
|
+
/**
|
|
601
|
+
* Is the response forbidden?
|
|
602
|
+
*/
|
|
603
|
+
isForbidden(): boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Is the response a not found error?
|
|
606
|
+
*/
|
|
607
|
+
isNotFound(): boolean;
|
|
608
|
+
/**
|
|
609
|
+
* Is the response a redirect of some form?
|
|
610
|
+
*/
|
|
611
|
+
isRedirect(location?: string | null): boolean;
|
|
612
|
+
/**
|
|
613
|
+
* Is the response empty?
|
|
614
|
+
*/
|
|
615
|
+
isEmpty(): boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Apply headers before sending response.
|
|
618
|
+
*/
|
|
619
|
+
sendHeaders(statusCode?: number): this;
|
|
620
|
+
/**
|
|
621
|
+
* Prepares the Response before it is sent to the client.
|
|
622
|
+
*
|
|
623
|
+
* This method tweaks the Response to ensure that it is
|
|
624
|
+
* compliant with RFC 2616. Most of the changes are based on
|
|
625
|
+
* the Request that is "associated" with this Response.
|
|
626
|
+
**/
|
|
627
|
+
prepare(request: Request): this;
|
|
628
|
+
/**
|
|
629
|
+
* Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9.
|
|
630
|
+
*
|
|
631
|
+
* @see http://support.microsoft.com/kb/323308
|
|
632
|
+
*/
|
|
633
|
+
protected ensureIEOverSSLCompatibility(request: Request): void;
|
|
474
634
|
}
|
|
475
635
|
//#endregion
|
|
476
|
-
//#region src/Exceptions/
|
|
477
|
-
declare class
|
|
478
|
-
|
|
636
|
+
//#region src/Exceptions/HttpResponseException.d.ts
|
|
637
|
+
declare class HttpResponseException extends Error {
|
|
638
|
+
/**
|
|
639
|
+
* The underlying response instance.
|
|
640
|
+
*/
|
|
641
|
+
protected response: HttpResponse;
|
|
642
|
+
/**
|
|
643
|
+
* Create a new HTTP response exception instance.
|
|
644
|
+
*
|
|
645
|
+
* @param response
|
|
646
|
+
* @param previous
|
|
647
|
+
*/
|
|
648
|
+
constructor(response: HttpResponse, previous?: Error);
|
|
649
|
+
/**
|
|
650
|
+
* Get the underlying response instance.
|
|
651
|
+
*/
|
|
652
|
+
getResponse(): HttpResponse;
|
|
479
653
|
}
|
|
480
654
|
//#endregion
|
|
481
655
|
//#region src/Exceptions/SuspiciousOperationException.d.ts
|
|
@@ -488,6 +662,20 @@ declare class UnexpectedValueException extends Error {
|
|
|
488
662
|
constructor(message: string);
|
|
489
663
|
}
|
|
490
664
|
//#endregion
|
|
665
|
+
//#region src/UploadedFile.d.ts
|
|
666
|
+
declare class UploadedFile {
|
|
667
|
+
originalName: string;
|
|
668
|
+
mimeType: string;
|
|
669
|
+
size: number;
|
|
670
|
+
content: File;
|
|
671
|
+
constructor(originalName: string, mimeType: string, size: number, content: File);
|
|
672
|
+
static createFromBase(file: File): UploadedFile;
|
|
673
|
+
/**
|
|
674
|
+
* Save to disk (Node environment only)
|
|
675
|
+
*/
|
|
676
|
+
moveTo(destination: string): Promise<void>;
|
|
677
|
+
}
|
|
678
|
+
//#endregion
|
|
491
679
|
//#region src/FormRequest.d.ts
|
|
492
680
|
declare class FormRequest {
|
|
493
681
|
protected dataset: {
|
|
@@ -515,6 +703,37 @@ declare class FormRequest {
|
|
|
515
703
|
all(): Record<string, any>;
|
|
516
704
|
}
|
|
517
705
|
//#endregion
|
|
706
|
+
//#region src/HttpContext.d.ts
|
|
707
|
+
/**
|
|
708
|
+
* Represents the HTTP context for a single request lifecycle.
|
|
709
|
+
* Encapsulates the application instance, request, and response objects.
|
|
710
|
+
*/
|
|
711
|
+
declare class HttpContext implements HttpContext$1 {
|
|
712
|
+
app: IApplication;
|
|
713
|
+
request: IRequest;
|
|
714
|
+
response: IResponse;
|
|
715
|
+
private static contexts;
|
|
716
|
+
constructor(app: IApplication, request: IRequest, response: IResponse);
|
|
717
|
+
/**
|
|
718
|
+
* Factory method to create a new HttpContext instance from a context object.
|
|
719
|
+
* @param ctx - Object containing app, request, and response
|
|
720
|
+
* @returns A new HttpContext instance
|
|
721
|
+
*/
|
|
722
|
+
static init(ctx: {
|
|
723
|
+
app: IApplication;
|
|
724
|
+
request: IRequest;
|
|
725
|
+
response: IResponse;
|
|
726
|
+
}, event?: unknown): HttpContext;
|
|
727
|
+
/**
|
|
728
|
+
* Retrieve an existing HttpContext instance for an event, if any.
|
|
729
|
+
*/
|
|
730
|
+
static get(event: unknown): HttpContext | undefined;
|
|
731
|
+
/**
|
|
732
|
+
* Delete the cached context for a given event (optional cleanup).
|
|
733
|
+
*/
|
|
734
|
+
static forget(event: unknown): void;
|
|
735
|
+
}
|
|
736
|
+
//#endregion
|
|
518
737
|
//#region src/Middleware.d.ts
|
|
519
738
|
declare abstract class Middleware implements IMiddleware {
|
|
520
739
|
abstract handle(context: HttpContext, next: () => Promise<unknown>): Promise<unknown>;
|
|
@@ -524,7 +743,7 @@ declare abstract class Middleware implements IMiddleware {
|
|
|
524
743
|
declare class LogRequests extends Middleware {
|
|
525
744
|
handle({
|
|
526
745
|
request
|
|
527
|
-
}: HttpContext
|
|
746
|
+
}: HttpContext, next: () => Promise<unknown>): Promise<unknown>;
|
|
528
747
|
}
|
|
529
748
|
//#endregion
|
|
530
749
|
//#region src/Providers/HttpServiceProvider.d.ts
|
|
@@ -546,73 +765,576 @@ declare class HttpServiceProvider {
|
|
|
546
765
|
boot(): void;
|
|
547
766
|
}
|
|
548
767
|
//#endregion
|
|
549
|
-
//#region src/
|
|
550
|
-
|
|
551
|
-
|
|
768
|
+
//#region src/Utilities/ParamBag.d.ts
|
|
769
|
+
/**
|
|
770
|
+
* ParamBag is a container for key/value pairs
|
|
771
|
+
* for Node/H3 environments.
|
|
772
|
+
*/
|
|
773
|
+
declare class ParamBag implements IParamBag {
|
|
774
|
+
protected parameters: RequestObject;
|
|
775
|
+
/**
|
|
776
|
+
* The current H3 H3Event instance
|
|
777
|
+
*/
|
|
778
|
+
readonly event: H3Event;
|
|
779
|
+
constructor(parameters: RequestObject | undefined,
|
|
780
|
+
/**
|
|
781
|
+
* The current H3 H3Event instance
|
|
782
|
+
*/
|
|
783
|
+
event: H3Event);
|
|
784
|
+
/**
|
|
785
|
+
* Returns the parameters.
|
|
786
|
+
* @
|
|
787
|
+
* @param key The name of the parameter to return or null to get them all
|
|
788
|
+
*
|
|
789
|
+
* @throws BadRequestException if the value is not an array
|
|
790
|
+
*/
|
|
791
|
+
all(key?: string): any;
|
|
792
|
+
get(key: string, defaultValue?: any): any;
|
|
793
|
+
set(key: string, value: any): void;
|
|
794
|
+
/**
|
|
795
|
+
* Returns true if the parameter is defined.
|
|
796
|
+
*
|
|
797
|
+
* @param key
|
|
798
|
+
*/
|
|
799
|
+
has(key: string): boolean;
|
|
800
|
+
/**
|
|
801
|
+
* Removes a parameter.
|
|
802
|
+
*
|
|
803
|
+
* @param key
|
|
804
|
+
*/
|
|
805
|
+
remove(key: string): void;
|
|
806
|
+
/**
|
|
807
|
+
*
|
|
808
|
+
* Returns the parameter as string.
|
|
809
|
+
*
|
|
810
|
+
* @param key
|
|
811
|
+
* @param defaultValue
|
|
812
|
+
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
813
|
+
* @returns
|
|
814
|
+
*/
|
|
815
|
+
getString(key: string, defaultValue?: string): string;
|
|
816
|
+
/**
|
|
817
|
+
* Returns the parameter value converted to integer.
|
|
818
|
+
*
|
|
819
|
+
* @param key
|
|
820
|
+
* @param defaultValue
|
|
821
|
+
* @throws UnexpectedValueException if the value cannot be converted to integer
|
|
822
|
+
*/
|
|
823
|
+
getInt(key: string, defaultValue?: number): number;
|
|
824
|
+
/**
|
|
825
|
+
* Returns the parameter value converted to boolean.
|
|
826
|
+
*
|
|
827
|
+
* @param key
|
|
828
|
+
* @param defaultValue
|
|
829
|
+
* @throws UnexpectedValueException if the value cannot be converted to a boolean
|
|
830
|
+
*/
|
|
831
|
+
getBoolean(key: string, defaultValue?: boolean): boolean;
|
|
832
|
+
/**
|
|
833
|
+
* Returns the alphabetic characters of the parameter value.
|
|
834
|
+
*
|
|
835
|
+
* @param key
|
|
836
|
+
* @param defaultValue
|
|
837
|
+
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
838
|
+
*/
|
|
839
|
+
getAlpha(key: string, defaultValue?: string): string;
|
|
840
|
+
/**
|
|
841
|
+
* Returns the alphabetic characters and digits of the parameter value.
|
|
842
|
+
*
|
|
843
|
+
* @param key
|
|
844
|
+
* @param defaultValue
|
|
845
|
+
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
846
|
+
*/
|
|
847
|
+
getAlnum(key: string, defaultValue?: string): string;
|
|
848
|
+
/**
|
|
849
|
+
* Returns the digits of the parameter value.
|
|
850
|
+
*
|
|
851
|
+
* @param key
|
|
852
|
+
* @param defaultValue
|
|
853
|
+
* @throws UnexpectedValueException if the value cannot be converted to string
|
|
854
|
+
* @returns
|
|
855
|
+
**/
|
|
856
|
+
getDigits(key: string, defaultValue?: string): string;
|
|
857
|
+
/**
|
|
858
|
+
* Returns the parameter keys.
|
|
859
|
+
*/
|
|
860
|
+
keys(): string[];
|
|
861
|
+
/**
|
|
862
|
+
* Replaces the current parameters by a new set.
|
|
863
|
+
*/
|
|
864
|
+
replace(parameters?: RequestObject): void;
|
|
865
|
+
/**
|
|
866
|
+
* Adds parameters.
|
|
867
|
+
*/
|
|
868
|
+
add(parameters?: RequestObject): void;
|
|
869
|
+
/**
|
|
870
|
+
* Returns the number of parameters.
|
|
871
|
+
*/
|
|
872
|
+
count(): number;
|
|
873
|
+
/**
|
|
874
|
+
* Returns an iterator for parameters.
|
|
875
|
+
*
|
|
876
|
+
* @returns
|
|
877
|
+
*/
|
|
878
|
+
[Symbol.iterator](): ArrayIterator<[string, any]>;
|
|
879
|
+
}
|
|
880
|
+
//#endregion
|
|
881
|
+
//#region src/Utilities/InputBag.d.ts
|
|
882
|
+
/**
|
|
883
|
+
* InputBag is a container for user input values
|
|
884
|
+
* (e.g., query params, body, cookies)
|
|
885
|
+
* for Node/H3 environments.
|
|
886
|
+
*/
|
|
887
|
+
declare class InputBag extends ParamBag {
|
|
888
|
+
constructor(inputs: RequestObject | undefined,
|
|
889
|
+
/**
|
|
890
|
+
* The current H3 H3Event instance
|
|
891
|
+
*/
|
|
892
|
+
event: H3Event);
|
|
893
|
+
/**
|
|
894
|
+
* Returns a scalar input value by name.
|
|
895
|
+
*
|
|
896
|
+
* @param key
|
|
897
|
+
* @param defaultValue
|
|
898
|
+
* @throws BadRequestException if the input contains a non-scalar value
|
|
899
|
+
* @returns
|
|
900
|
+
*/
|
|
901
|
+
get<T extends string | number | boolean | null>(key: string, defaultValue?: T | null): T | string | number | boolean | null;
|
|
902
|
+
/**
|
|
903
|
+
* Replaces all current input values.
|
|
904
|
+
*
|
|
905
|
+
* @param inputs
|
|
906
|
+
* @returns
|
|
907
|
+
*/
|
|
908
|
+
replace(inputs?: RequestObject): void;
|
|
909
|
+
/**
|
|
910
|
+
* Adds multiple input values.
|
|
911
|
+
*
|
|
912
|
+
* @param inputs
|
|
913
|
+
* @returns
|
|
914
|
+
*/
|
|
915
|
+
add(inputs?: RequestObject): void;
|
|
916
|
+
/**
|
|
917
|
+
* Sets an input by name.
|
|
918
|
+
*
|
|
919
|
+
* @param key
|
|
920
|
+
* @param value
|
|
921
|
+
* @throws TypeError if value is not scalar or array
|
|
922
|
+
* @returns
|
|
923
|
+
*/
|
|
924
|
+
set(key: string, value: any): void;
|
|
925
|
+
/**
|
|
926
|
+
* Returns true if a key exists.
|
|
927
|
+
*
|
|
928
|
+
* @param key
|
|
929
|
+
* @returns
|
|
930
|
+
*/
|
|
931
|
+
has(key: string): boolean;
|
|
932
|
+
/**
|
|
933
|
+
* Returns all parameters.
|
|
934
|
+
*
|
|
935
|
+
* @returns
|
|
936
|
+
*/
|
|
937
|
+
all(): RequestObject;
|
|
938
|
+
/**
|
|
939
|
+
* Converts a parameter value to string.
|
|
940
|
+
*
|
|
941
|
+
* @param key
|
|
942
|
+
* @param defaultValue
|
|
943
|
+
* @throws BadRequestException if input contains a non-scalar value
|
|
944
|
+
* @returns
|
|
945
|
+
*/
|
|
946
|
+
getString(key: string, defaultValue?: string): string;
|
|
947
|
+
/**
|
|
948
|
+
* Filters input value with a predicate.
|
|
949
|
+
* Mimics PHP’s filter_var() in spirit, but simpler.
|
|
950
|
+
*
|
|
951
|
+
* @param key
|
|
952
|
+
* @param defaultValue
|
|
953
|
+
* @param filterFn
|
|
954
|
+
* @throws BadRequestException if validation fails
|
|
955
|
+
* @returns
|
|
956
|
+
*/
|
|
957
|
+
filter<T = any>(key: string, defaultValue?: T | null, filterFn?: (value: any) => boolean): T | null;
|
|
958
|
+
/**
|
|
959
|
+
* Returns an enum value by key.
|
|
960
|
+
*
|
|
961
|
+
* @param key
|
|
962
|
+
* @param EnumClass
|
|
963
|
+
* @param defaultValue
|
|
964
|
+
* @throws BadRequestException if conversion fails
|
|
965
|
+
* @returns
|
|
966
|
+
*/
|
|
967
|
+
getEnum<T extends Record<string, string | number>>(key: string, EnumClass: T, defaultValue?: T[keyof T] | null): T[keyof T] | null;
|
|
968
|
+
/**
|
|
969
|
+
* Removes a key.
|
|
970
|
+
*
|
|
971
|
+
* @param key
|
|
972
|
+
*/
|
|
973
|
+
remove(key: string): void;
|
|
974
|
+
/**
|
|
975
|
+
* Returns all keys.
|
|
976
|
+
*
|
|
977
|
+
* @returns
|
|
978
|
+
*/
|
|
979
|
+
keys(): string[];
|
|
980
|
+
/**
|
|
981
|
+
* Returns number of parameters.
|
|
982
|
+
*
|
|
983
|
+
* @returns
|
|
984
|
+
*/
|
|
985
|
+
count(): number;
|
|
986
|
+
}
|
|
987
|
+
//#endregion
|
|
988
|
+
//#region src/Utilities/FileBag.d.ts
|
|
989
|
+
type FileInput = UploadedFile | File | null | undefined;
|
|
990
|
+
/**
|
|
991
|
+
* FileBag is a container for uploaded files
|
|
992
|
+
* for Node/H3 environments.
|
|
993
|
+
*/
|
|
994
|
+
declare class FileBag extends ParamBag {
|
|
995
|
+
protected parameters: Record<string, UploadedFile | UploadedFile[] | null>;
|
|
996
|
+
constructor(parameters: Record<string, FileInput | FileInput[]> | undefined,
|
|
997
|
+
/**
|
|
998
|
+
* The current H3 H3Event instance
|
|
999
|
+
*/
|
|
1000
|
+
event: H3Event);
|
|
1001
|
+
/**
|
|
1002
|
+
* Replace all stored files.
|
|
1003
|
+
*/
|
|
1004
|
+
replace(files?: Record<string, FileInput | FileInput[]>): void;
|
|
1005
|
+
/**
|
|
1006
|
+
* Set a file or array of files.
|
|
1007
|
+
*/
|
|
1008
|
+
set(key: string, value: FileInput | FileInput[]): void;
|
|
1009
|
+
/**
|
|
1010
|
+
* Add multiple files.
|
|
1011
|
+
*/
|
|
1012
|
+
add(files?: Record<string, FileInput | FileInput[]>): void;
|
|
1013
|
+
/**
|
|
1014
|
+
* Get all stored files.
|
|
1015
|
+
*/
|
|
1016
|
+
all(): Record<string, UploadedFile | UploadedFile[] | null>;
|
|
1017
|
+
/**
|
|
1018
|
+
* Normalize file input into UploadedFile instances.
|
|
1019
|
+
*/
|
|
1020
|
+
protected convertFileInformation(file: FileInput): UploadedFile | null;
|
|
1021
|
+
}
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/Utilities/ServerBag.d.ts
|
|
1024
|
+
/**
|
|
1025
|
+
* ServerBag — a simplified version of Symfony's ServerBag
|
|
1026
|
+
* for Node/H3 environments.
|
|
1027
|
+
*
|
|
1028
|
+
* Responsible for extracting and normalizing HTTP headers
|
|
1029
|
+
* from the incoming request.
|
|
1030
|
+
*/
|
|
1031
|
+
declare class ServerBag extends ParamBag {
|
|
1032
|
+
constructor(parameters: Record<string, string | undefined> | undefined,
|
|
1033
|
+
/**
|
|
1034
|
+
* The current H3 H3Event instance
|
|
1035
|
+
*/
|
|
1036
|
+
event: H3Event);
|
|
1037
|
+
/**
|
|
1038
|
+
* Returns all request headers, normalized to uppercase with underscores.
|
|
1039
|
+
* Example: content-type → CONTENT_TYPE
|
|
1040
|
+
*/
|
|
1041
|
+
getHeaders(): Record<string, string>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Returns a specific header by name, case-insensitive.
|
|
1044
|
+
*/
|
|
1045
|
+
get(name: string): string | undefined;
|
|
1046
|
+
/**
|
|
1047
|
+
* Returns true if a header exists.
|
|
1048
|
+
*/
|
|
1049
|
+
has(name: string): boolean;
|
|
1050
|
+
}
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region src/Utilities/HttpRequest.d.ts
|
|
1053
|
+
declare class HttpRequest {
|
|
1054
|
+
#private;
|
|
1055
|
+
/**
|
|
1056
|
+
* The current H3 H3Event instance
|
|
1057
|
+
*/
|
|
1058
|
+
protected readonly event: H3Event;
|
|
1059
|
+
/**
|
|
1060
|
+
* The current app instance
|
|
1061
|
+
*/
|
|
1062
|
+
app: Application;
|
|
1063
|
+
HEADER_FORWARDED: number;
|
|
1064
|
+
HEADER_X_FORWARDED_FOR: number;
|
|
1065
|
+
HEADER_X_FORWARDED_HOST: number;
|
|
1066
|
+
HEADER_X_FORWARDED_PROTO: number;
|
|
1067
|
+
HEADER_X_FORWARDED_PORT: number;
|
|
1068
|
+
HEADER_X_FORWARDED_PREFIX: number;
|
|
1069
|
+
HEADER_X_FORWARDED_AWS_ELB: number;
|
|
1070
|
+
HEADER_X_FORWARDED_TRAEFIK: number;
|
|
1071
|
+
METHOD_HEAD: string;
|
|
1072
|
+
METHOD_GET: string;
|
|
1073
|
+
METHOD_POST: string;
|
|
1074
|
+
METHOD_PUT: string;
|
|
1075
|
+
METHOD_PATCH: string;
|
|
1076
|
+
METHOD_DELETE: string;
|
|
1077
|
+
METHOD_PURGE: string;
|
|
1078
|
+
METHOD_OPTIONS: string;
|
|
1079
|
+
METHOD_TRACE: string;
|
|
1080
|
+
METHOD_CONNECT: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* Names for headers that can be trusted when
|
|
1083
|
+
* using trusted proxies.
|
|
1084
|
+
*
|
|
1085
|
+
* The FORWARDED header is the standard as of rfc7239.
|
|
1086
|
+
*
|
|
1087
|
+
* The other headers are non-standard, but widely used
|
|
1088
|
+
* by popular reverse proxies (like Apache mod_proxy or Amazon EC2).
|
|
1089
|
+
*/
|
|
1090
|
+
private TRUSTED_HEADERS;
|
|
1091
|
+
private FORWARDED_PARAMS;
|
|
1092
|
+
/**
|
|
1093
|
+
* Parsed request body
|
|
1094
|
+
*/
|
|
1095
|
+
body: unknown;
|
|
1096
|
+
protected format?: string;
|
|
1097
|
+
protected formData: FormRequest;
|
|
1098
|
+
private preferredFormat?;
|
|
1099
|
+
private isForwardedValid;
|
|
1100
|
+
private static trustedHeaderSet;
|
|
1101
|
+
/**
|
|
1102
|
+
* Gets route parameters.
|
|
1103
|
+
* @returns An object containing route parameters.
|
|
1104
|
+
*/
|
|
1105
|
+
params: NonNullable<H3Event['context']['params']>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Request body parameters (POST).
|
|
1108
|
+
*
|
|
1109
|
+
* @see getPayload() for portability between content types
|
|
1110
|
+
*/
|
|
1111
|
+
protected request: InputBag;
|
|
1112
|
+
/**
|
|
1113
|
+
* Uploaded files (FILES).
|
|
1114
|
+
*/
|
|
1115
|
+
files: FileBag;
|
|
1116
|
+
/**
|
|
1117
|
+
* Query string parameters (GET).
|
|
1118
|
+
*/
|
|
1119
|
+
query: InputBag;
|
|
1120
|
+
/**
|
|
1121
|
+
* Server and execution environment parameters
|
|
1122
|
+
*/
|
|
1123
|
+
server: ServerBag;
|
|
1124
|
+
/**
|
|
1125
|
+
* Cookies
|
|
1126
|
+
*/
|
|
1127
|
+
cookies: InputBag;
|
|
1128
|
+
/**
|
|
1129
|
+
* The request attributes (parameters parsed from the PATH_INFO, ...).
|
|
1130
|
+
*/
|
|
1131
|
+
attributes: ParamBag;
|
|
1132
|
+
/**
|
|
1133
|
+
* Gets the request headers.
|
|
1134
|
+
* @returns An object containing request headers.
|
|
1135
|
+
*/
|
|
1136
|
+
headers: HeaderBag;
|
|
1137
|
+
protected content?: ReadableStream | string | false | null;
|
|
1138
|
+
protected static formats?: Record<string, string[]> | undefined | null;
|
|
1139
|
+
protected static trustedProxies: string[];
|
|
1140
|
+
protected static httpMethodParameterOverride: boolean;
|
|
1141
|
+
/**
|
|
1142
|
+
* List of Acceptable Content Types
|
|
1143
|
+
*/
|
|
1144
|
+
private acceptableContentTypes;
|
|
1145
|
+
private trustedValuesCache;
|
|
1146
|
+
constructor(
|
|
1147
|
+
/**
|
|
1148
|
+
* The current H3 H3Event instance
|
|
1149
|
+
*/
|
|
1150
|
+
event: H3Event,
|
|
1151
|
+
/**
|
|
1152
|
+
* The current app instance
|
|
1153
|
+
*/
|
|
1154
|
+
app: Application);
|
|
1155
|
+
/**
|
|
1156
|
+
* Sets the parameters for this request.
|
|
1157
|
+
*
|
|
1158
|
+
* This method also re-initializes all properties.
|
|
1159
|
+
*
|
|
1160
|
+
* @param attributes
|
|
1161
|
+
* @param cookies The COOKIE parameters
|
|
1162
|
+
* @param files The FILES parameters
|
|
1163
|
+
* @param server The SERVER parameters
|
|
1164
|
+
* @param content The raw body data
|
|
1165
|
+
*/
|
|
1166
|
+
initialize(): Promise<void>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Gets a list of content types acceptable by the client browser in preferable order.
|
|
1169
|
+
* @returns {string[]}
|
|
1170
|
+
*/
|
|
1171
|
+
getAcceptableContentTypes(): string[];
|
|
1172
|
+
/**
|
|
1173
|
+
* Get a URI instance for the request.
|
|
1174
|
+
*/
|
|
1175
|
+
getUriInstance(): Url;
|
|
1176
|
+
/**
|
|
1177
|
+
* Checks whether the request is secure or not.
|
|
1178
|
+
*
|
|
1179
|
+
* This method can read the client protocol from the "X-Forwarded-Proto" header
|
|
1180
|
+
* when trusted proxies were set via "setTrustedProxies()".
|
|
1181
|
+
*
|
|
1182
|
+
* The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".
|
|
1183
|
+
*/
|
|
1184
|
+
isSecure(): boolean;
|
|
1185
|
+
/**
|
|
1186
|
+
* Returns the value of the requested header.
|
|
1187
|
+
*/
|
|
1188
|
+
getHeader(name: string): string | undefined | null;
|
|
1189
|
+
/**
|
|
1190
|
+
* Checks if the request method is of specified type.
|
|
1191
|
+
*
|
|
1192
|
+
* @param method Uppercase request method (GET, POST etc)
|
|
1193
|
+
*/
|
|
1194
|
+
isMethod(method: string): boolean;
|
|
1195
|
+
/**
|
|
1196
|
+
* Checks whether or not the method is safe.
|
|
1197
|
+
*
|
|
1198
|
+
* @see https://tools.ietf.org/html/rfc7231#section-4.2.1
|
|
1199
|
+
*/
|
|
1200
|
+
isMethodSafe(): boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* Checks whether or not the method is idempotent.
|
|
1203
|
+
*/
|
|
1204
|
+
isMethodIdempotent(): boolean;
|
|
1205
|
+
/**
|
|
1206
|
+
* Checks whether the method is cacheable or not.
|
|
1207
|
+
*
|
|
1208
|
+
* @see https://tools.ietf.org/html/rfc7231#section-4.2.3
|
|
1209
|
+
*/
|
|
1210
|
+
isMethodCacheable(): boolean;
|
|
1211
|
+
/**
|
|
1212
|
+
* Returns true if the request is an XMLHttpRequest (AJAX).
|
|
1213
|
+
*/
|
|
1214
|
+
isXmlHttpRequest(): boolean;
|
|
1215
|
+
/**
|
|
1216
|
+
* Initializes HTTP request formats.
|
|
1217
|
+
*/
|
|
1218
|
+
protected static initializeFormats(): void;
|
|
1219
|
+
/**
|
|
1220
|
+
* Gets the request "intended" method.
|
|
1221
|
+
*
|
|
1222
|
+
* If the X-HTTP-Method-Override header is set, and if the method is a POST,
|
|
1223
|
+
* then it is used to determine the "real" intended HTTP method.
|
|
1224
|
+
*
|
|
1225
|
+
* The _method request parameter can also be used to determine the HTTP method,
|
|
1226
|
+
* but only if enableHttpMethodParameterOverride() has been called.
|
|
1227
|
+
*
|
|
1228
|
+
* The method is always an uppercased string.
|
|
1229
|
+
*
|
|
1230
|
+
* @see getRealMethod()
|
|
1231
|
+
*/
|
|
1232
|
+
getMethod(): RequestMethod;
|
|
552
1233
|
/**
|
|
553
|
-
*
|
|
1234
|
+
* Gets the preferred format for the response by inspecting, in the following order:
|
|
1235
|
+
* * the request format set using setRequestFormat;
|
|
1236
|
+
* * the values of the Accept HTTP header.
|
|
1237
|
+
*
|
|
1238
|
+
* Note that if you use this method, you should send the "Vary: Accept" header
|
|
1239
|
+
* in the response to prevent any issues with intermediary HTTP caches.
|
|
554
1240
|
*/
|
|
555
|
-
|
|
1241
|
+
getPreferredFormat(defaultValue?: string): string | undefined;
|
|
556
1242
|
/**
|
|
557
|
-
*
|
|
1243
|
+
* Gets the format associated with the mime type.
|
|
558
1244
|
*/
|
|
559
|
-
|
|
1245
|
+
getFormat(mimeType: string): string | undefined;
|
|
560
1246
|
/**
|
|
561
|
-
*
|
|
1247
|
+
* Gets the request format.
|
|
1248
|
+
*
|
|
1249
|
+
* Here is the process to determine the format:
|
|
1250
|
+
*
|
|
1251
|
+
* * format defined by the user (with setRequestFormat())
|
|
1252
|
+
* * _format request attribute
|
|
1253
|
+
* * $default
|
|
1254
|
+
*
|
|
1255
|
+
* @see getPreferredFormat
|
|
562
1256
|
*/
|
|
563
|
-
|
|
1257
|
+
getRequestFormat(defaultValue?: string): string | undefined;
|
|
564
1258
|
/**
|
|
565
|
-
*
|
|
566
|
-
* @returns An object containing route parameters.
|
|
1259
|
+
* Sets the request format.
|
|
567
1260
|
*/
|
|
568
|
-
|
|
1261
|
+
setRequestFormat(format: string): void;
|
|
569
1262
|
/**
|
|
570
|
-
*
|
|
1263
|
+
* Gets the "real" request method.
|
|
1264
|
+
*
|
|
1265
|
+
* @see getMethod()
|
|
571
1266
|
*/
|
|
572
|
-
|
|
1267
|
+
getRealMethod(): RequestMethod;
|
|
573
1268
|
/**
|
|
574
|
-
*
|
|
575
|
-
* @returns The FormRequest object.
|
|
1269
|
+
* Gets the mime type associated with the format.
|
|
576
1270
|
*/
|
|
577
|
-
|
|
1271
|
+
getMimeType(format: string): string | undefined;
|
|
578
1272
|
/**
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
* @see getPayload() for portability between content types
|
|
1273
|
+
* Gets the mime types associated with the format.
|
|
582
1274
|
*/
|
|
583
|
-
|
|
1275
|
+
static getMimeTypes(format: string): string[];
|
|
584
1276
|
/**
|
|
585
|
-
*
|
|
1277
|
+
* Gets the list of trusted proxies.
|
|
586
1278
|
*/
|
|
587
|
-
|
|
1279
|
+
static getTrustedProxies(): string[];
|
|
588
1280
|
/**
|
|
589
|
-
*
|
|
1281
|
+
* Returns the request body content.
|
|
1282
|
+
*
|
|
1283
|
+
* @param asStream If true, returns a ReadableStream instead of the parsed string
|
|
1284
|
+
* @return {string | ReadableStream | Promise<string | ReadableStream>}
|
|
590
1285
|
*/
|
|
591
|
-
|
|
1286
|
+
getContent(asStream?: boolean): string | ReadableStream;
|
|
592
1287
|
/**
|
|
593
|
-
*
|
|
1288
|
+
* Gets a "parameter" value from any bag.
|
|
1289
|
+
*
|
|
1290
|
+
* This method is mainly useful for libraries that want to provide some flexibility. If you don't need the
|
|
1291
|
+
* flexibility in controllers, it is better to explicitly get request parameters from the appropriate
|
|
1292
|
+
* public property instead (attributes, query, request).
|
|
1293
|
+
*
|
|
1294
|
+
* Order of precedence: PATH (routing placeholders or custom attributes), GET, POST
|
|
1295
|
+
*
|
|
1296
|
+
* @internal use explicit input sources instead
|
|
594
1297
|
*/
|
|
595
|
-
|
|
1298
|
+
get(key: string, defaultValue?: any): any;
|
|
596
1299
|
/**
|
|
597
|
-
*
|
|
1300
|
+
* Indicates whether this request originated from a trusted proxy.
|
|
1301
|
+
*
|
|
1302
|
+
* This can be useful to determine whether or not to trust the
|
|
1303
|
+
* contents of a proxy-specific header.
|
|
598
1304
|
*/
|
|
599
|
-
|
|
1305
|
+
isFromTrustedProxy(): boolean;
|
|
600
1306
|
/**
|
|
601
|
-
*
|
|
1307
|
+
* This method is rather heavy because it splits and merges headers, and it's called by many other methods such as
|
|
1308
|
+
* getPort(), isSecure(), getHost(), getClientIps(), getBaseUrl() etc. Thus, we try to cache the results for
|
|
1309
|
+
* best performance.
|
|
602
1310
|
*/
|
|
603
|
-
|
|
1311
|
+
private getTrustedValues;
|
|
1312
|
+
private normalizeAndFilterClientIps;
|
|
604
1313
|
/**
|
|
605
|
-
*
|
|
606
|
-
*
|
|
1314
|
+
* Enables support for the _method request parameter to determine the intended HTTP method.
|
|
1315
|
+
*
|
|
1316
|
+
* Be warned that enabling this feature might lead to CSRF issues in your code.
|
|
1317
|
+
* Check that you are using CSRF tokens when required.
|
|
1318
|
+
* If the HTTP method parameter override is enabled, an html-form with method "POST" can be altered
|
|
1319
|
+
* and used to send a "PUT" or "DELETE" request via the _method request parameter.
|
|
1320
|
+
* If these methods are not protected against CSRF, this presents a possible vulnerability.
|
|
1321
|
+
*
|
|
1322
|
+
* The HTTP method can only be overridden when the real HTTP method is POST.
|
|
607
1323
|
*/
|
|
608
|
-
|
|
609
|
-
protected content?: ReadableStream | string | false | null;
|
|
610
|
-
protected static formats?: Record<string, string[]> | undefined | null;
|
|
611
|
-
protected static httpMethodParameterOverride: boolean;
|
|
1324
|
+
static enableHttpMethodParameterOverride(): void;
|
|
612
1325
|
/**
|
|
613
|
-
*
|
|
1326
|
+
* Checks whether support for the _method request parameter is enabled.
|
|
614
1327
|
*/
|
|
615
|
-
|
|
1328
|
+
static getHttpMethodParameterOverride(): boolean;
|
|
1329
|
+
}
|
|
1330
|
+
//#endregion
|
|
1331
|
+
//#region src/Request.d.ts
|
|
1332
|
+
declare class Request extends HttpRequest implements IRequest {
|
|
1333
|
+
#private;
|
|
1334
|
+
/**
|
|
1335
|
+
* All of the converted files for the request.
|
|
1336
|
+
*/
|
|
1337
|
+
protected convertedFiles?: Record<string, UploadedFile | UploadedFile[]>;
|
|
616
1338
|
constructor(
|
|
617
1339
|
/**
|
|
618
1340
|
* The current H3 H3Event instance
|
|
@@ -634,18 +1356,6 @@ declare class Request implements IRequest {
|
|
|
634
1356
|
* The current app instance
|
|
635
1357
|
*/
|
|
636
1358
|
app: Application): Promise<Request>;
|
|
637
|
-
/**
|
|
638
|
-
* Sets the parameters for this request.
|
|
639
|
-
*
|
|
640
|
-
* This method also re-initializes all properties.
|
|
641
|
-
*
|
|
642
|
-
* @param attributes
|
|
643
|
-
* @param cookies The COOKIE parameters
|
|
644
|
-
* @param files The FILES parameters
|
|
645
|
-
* @param server The SERVER parameters
|
|
646
|
-
* @param content The raw body data
|
|
647
|
-
*/
|
|
648
|
-
initialize(): Promise<void>;
|
|
649
1359
|
private setBody;
|
|
650
1360
|
/**
|
|
651
1361
|
* Retrieve all data from the instance (query + body).
|
|
@@ -755,11 +1465,6 @@ declare class Request implements IRequest {
|
|
|
755
1465
|
* @returns
|
|
756
1466
|
*/
|
|
757
1467
|
wantsJson(): boolean;
|
|
758
|
-
/**
|
|
759
|
-
* Gets a list of content types acceptable by the client browser in preferable order.
|
|
760
|
-
* @returns {string[]}
|
|
761
|
-
*/
|
|
762
|
-
getAcceptableContentTypes(): string[];
|
|
763
1468
|
/**
|
|
764
1469
|
* Determine if the request is the result of a PJAX call.
|
|
765
1470
|
*
|
|
@@ -773,60 +1478,6 @@ declare class Request implements IRequest {
|
|
|
773
1478
|
* @returns {boolean}
|
|
774
1479
|
*/
|
|
775
1480
|
ajax(): boolean;
|
|
776
|
-
/**
|
|
777
|
-
* Returns true if the request is an XMLHttpRequest (AJAX).
|
|
778
|
-
*/
|
|
779
|
-
isXmlHttpRequest(): boolean;
|
|
780
|
-
/**
|
|
781
|
-
* Returns the value of the requested header.
|
|
782
|
-
*/
|
|
783
|
-
getHeader(name: string): string | undefined | null;
|
|
784
|
-
/**
|
|
785
|
-
* Checks if the request method is of specified type.
|
|
786
|
-
*
|
|
787
|
-
* @param method Uppercase request method (GET, POST etc)
|
|
788
|
-
*/
|
|
789
|
-
isMethod(method: string): boolean;
|
|
790
|
-
/**
|
|
791
|
-
* Checks whether or not the method is safe.
|
|
792
|
-
*
|
|
793
|
-
* @see https://tools.ietf.org/html/rfc7231#section-4.2.1
|
|
794
|
-
*/
|
|
795
|
-
isMethodSafe(): boolean;
|
|
796
|
-
/**
|
|
797
|
-
* Checks whether or not the method is idempotent.
|
|
798
|
-
*/
|
|
799
|
-
isMethodIdempotent(): boolean;
|
|
800
|
-
/**
|
|
801
|
-
* Checks whether the method is cacheable or not.
|
|
802
|
-
*
|
|
803
|
-
* @see https://tools.ietf.org/html/rfc7231#section-4.2.3
|
|
804
|
-
*/
|
|
805
|
-
isMethodCacheable(): boolean;
|
|
806
|
-
/**
|
|
807
|
-
* Initializes HTTP request formats.
|
|
808
|
-
*/
|
|
809
|
-
protected static initializeFormats(): void;
|
|
810
|
-
/**
|
|
811
|
-
* Gets the request "intended" method.
|
|
812
|
-
*
|
|
813
|
-
* If the X-HTTP-Method-Override header is set, and if the method is a POST,
|
|
814
|
-
* then it is used to determine the "real" intended HTTP method.
|
|
815
|
-
*
|
|
816
|
-
* The _method request parameter can also be used to determine the HTTP method,
|
|
817
|
-
* but only if enableHttpMethodParameterOverride() has been called.
|
|
818
|
-
*
|
|
819
|
-
* The method is always an uppercased string.
|
|
820
|
-
*
|
|
821
|
-
* @see getRealMethod()
|
|
822
|
-
*/
|
|
823
|
-
getMethod(): RequestMethod;
|
|
824
|
-
/**
|
|
825
|
-
* Gets the "real" request method.
|
|
826
|
-
*
|
|
827
|
-
* @see getMethod()
|
|
828
|
-
*/
|
|
829
|
-
getRealMethod(): RequestMethod;
|
|
830
1481
|
/**
|
|
831
1482
|
* Get the client IP address.
|
|
832
1483
|
*/
|
|
@@ -861,46 +1512,10 @@ declare class Request implements IRequest {
|
|
|
861
1512
|
* @return {InputBag}
|
|
862
1513
|
*/
|
|
863
1514
|
protected getInputSource(): InputBag;
|
|
864
|
-
/**
|
|
865
|
-
* Returns the request body content.
|
|
866
|
-
*
|
|
867
|
-
* @param asStream If true, returns a ReadableStream instead of the parsed string
|
|
868
|
-
* @return {string | ReadableStream | Promise<string | ReadableStream>}
|
|
869
|
-
*/
|
|
870
|
-
getContent(asStream?: boolean): string | ReadableStream;
|
|
871
|
-
/**
|
|
872
|
-
* Gets a "parameter" value from any bag.
|
|
873
|
-
*
|
|
874
|
-
* This method is mainly useful for libraries that want to provide some flexibility. If you don't need the
|
|
875
|
-
* flexibility in controllers, it is better to explicitly get request parameters from the appropriate
|
|
876
|
-
* public property instead (attributes, query, request).
|
|
877
|
-
*
|
|
878
|
-
* Order of precedence: PATH (routing placeholders or custom attributes), GET, POST
|
|
879
|
-
*
|
|
880
|
-
* @internal use explicit input sources instead
|
|
881
|
-
*/
|
|
882
|
-
get(key: string, defaultValue?: any): any;
|
|
883
|
-
/**
|
|
884
|
-
* Enables support for the _method request parameter to determine the intended HTTP method.
|
|
885
|
-
*
|
|
886
|
-
* Be warned that enabling this feature might lead to CSRF issues in your code.
|
|
887
|
-
* Check that you are using CSRF tokens when required.
|
|
888
|
-
* If the HTTP method parameter override is enabled, an html-form with method "POST" can be altered
|
|
889
|
-
* and used to send a "PUT" or "DELETE" request via the _method request parameter.
|
|
890
|
-
* If these methods are not protected against CSRF, this presents a possible vulnerability.
|
|
891
|
-
*
|
|
892
|
-
* The HTTP method can only be overridden when the real HTTP method is POST.
|
|
893
|
-
*/
|
|
894
|
-
static enableHttpMethodParameterOverride(): void;
|
|
895
|
-
/**
|
|
896
|
-
* Checks whether support for the _method request parameter is enabled.
|
|
897
|
-
*/
|
|
898
|
-
static getHttpMethodParameterOverride(): boolean;
|
|
899
1515
|
/**
|
|
900
1516
|
* Dump the items.
|
|
901
1517
|
*
|
|
902
1518
|
* @param keys
|
|
903
|
-
* @return this
|
|
904
1519
|
*/
|
|
905
1520
|
dump(...keys: any[]): this;
|
|
906
1521
|
/**
|
|
@@ -929,7 +1544,7 @@ type BodyResource = Resource & {
|
|
|
929
1544
|
/**
|
|
930
1545
|
* Class to render API resource
|
|
931
1546
|
*/
|
|
932
|
-
declare class JsonResource<R
|
|
1547
|
+
declare class JsonResource<R extends Resource = any> {
|
|
933
1548
|
#private;
|
|
934
1549
|
protected event: H3Event;
|
|
935
1550
|
/**
|
|
@@ -943,7 +1558,7 @@ declare class JsonResource<R$1 extends Resource = any> {
|
|
|
943
1558
|
/**
|
|
944
1559
|
* The data to send to the client
|
|
945
1560
|
*/
|
|
946
|
-
resource: R
|
|
1561
|
+
resource: R;
|
|
947
1562
|
/**
|
|
948
1563
|
* The final response data object
|
|
949
1564
|
*/
|
|
@@ -965,7 +1580,7 @@ declare class JsonResource<R$1 extends Resource = any> {
|
|
|
965
1580
|
* @param res The response instance
|
|
966
1581
|
* @param rsc The data to send to the client
|
|
967
1582
|
*/
|
|
968
|
-
constructor(event: H3Event, rsc: R
|
|
1583
|
+
constructor(event: H3Event, rsc: R);
|
|
969
1584
|
/**
|
|
970
1585
|
* Return the data in the expected format
|
|
971
1586
|
*
|
|
@@ -1006,47 +1621,66 @@ declare class JsonResource<R$1 extends Resource = any> {
|
|
|
1006
1621
|
declare function ApiResource(instance: JsonResource): JsonResource<any>;
|
|
1007
1622
|
//#endregion
|
|
1008
1623
|
//#region src/Response.d.ts
|
|
1009
|
-
declare class Response implements IResponse {
|
|
1624
|
+
declare class Response extends HttpResponse implements IResponse {
|
|
1010
1625
|
/**
|
|
1011
1626
|
* The current app instance
|
|
1012
1627
|
*/
|
|
1013
1628
|
app: Application;
|
|
1629
|
+
constructor(
|
|
1014
1630
|
/**
|
|
1015
1631
|
* The current H3 H3Event instance
|
|
1016
1632
|
*/
|
|
1017
|
-
|
|
1018
|
-
private statusCode;
|
|
1019
|
-
private headers;
|
|
1020
|
-
constructor(event: H3Event,
|
|
1633
|
+
event: H3Event,
|
|
1021
1634
|
/**
|
|
1022
1635
|
* The current app instance
|
|
1023
1636
|
*/
|
|
1024
1637
|
app: Application);
|
|
1025
1638
|
/**
|
|
1026
|
-
*
|
|
1639
|
+
* Sends content for the current web response.
|
|
1027
1640
|
*/
|
|
1028
|
-
|
|
1641
|
+
sendContent(type?: 'html' | 'json' | 'text' | 'xml', parse?: boolean): unknown;
|
|
1029
1642
|
/**
|
|
1030
|
-
*
|
|
1643
|
+
* Sends content for the current web response.
|
|
1031
1644
|
*/
|
|
1032
|
-
|
|
1033
|
-
|
|
1645
|
+
send(type?: 'html' | 'json' | 'text' | 'xml'): unknown;
|
|
1646
|
+
/**
|
|
1647
|
+
*
|
|
1648
|
+
* @param content The content to serve
|
|
1649
|
+
* @param send if set to true, the content will be returned, instead of the Response instance
|
|
1650
|
+
* @returns
|
|
1651
|
+
*/
|
|
1652
|
+
html(content?: string): this;
|
|
1653
|
+
html(content: string, parse: boolean): HTTPResponse;
|
|
1034
1654
|
/**
|
|
1035
1655
|
* Send a JSON response.
|
|
1036
1656
|
*/
|
|
1037
|
-
json<T = unknown>(data
|
|
1657
|
+
json<T = unknown>(data?: T): this;
|
|
1658
|
+
json<T = unknown>(data: T, parse: boolean): T;
|
|
1038
1659
|
/**
|
|
1039
1660
|
* Send plain text.
|
|
1040
1661
|
*/
|
|
1041
|
-
text(
|
|
1662
|
+
text(content?: string): this;
|
|
1663
|
+
text(content: string, parse: boolean): HTTPResponse;
|
|
1664
|
+
/**
|
|
1665
|
+
* Send plain xml.
|
|
1666
|
+
*/
|
|
1667
|
+
xml(data?: string): this;
|
|
1668
|
+
xml(data: string, parse: boolean): HTTPResponse;
|
|
1669
|
+
/**
|
|
1670
|
+
* Build the HTTP Response
|
|
1671
|
+
*
|
|
1672
|
+
* @param contentType
|
|
1673
|
+
* @param data
|
|
1674
|
+
*/
|
|
1675
|
+
private httpResponse;
|
|
1042
1676
|
/**
|
|
1043
1677
|
* Redirect to another URL.
|
|
1044
1678
|
*/
|
|
1045
1679
|
redirect(location: string, status?: number, statusText?: string | undefined): HTTPResponse;
|
|
1046
1680
|
/**
|
|
1047
|
-
*
|
|
1681
|
+
* Dump the response.
|
|
1048
1682
|
*/
|
|
1049
|
-
|
|
1683
|
+
dump(): this;
|
|
1050
1684
|
/**
|
|
1051
1685
|
* Get the base event
|
|
1052
1686
|
*/
|
|
@@ -1054,4 +1688,210 @@ declare class Response implements IResponse {
|
|
|
1054
1688
|
getEvent<K extends DotNestedKeys<H3Event>>(key: K): DotNestedValue<H3Event, K>;
|
|
1055
1689
|
}
|
|
1056
1690
|
//#endregion
|
|
1057
|
-
|
|
1691
|
+
//#region src/Utilities/HeaderUtility.d.ts
|
|
1692
|
+
/**
|
|
1693
|
+
* HTTP header utility functions .
|
|
1694
|
+
*/
|
|
1695
|
+
declare class HeaderUtility {
|
|
1696
|
+
static readonly DISPOSITION_ATTACHMENT = "attachment";
|
|
1697
|
+
static readonly DISPOSITION_INLINE = "inline";
|
|
1698
|
+
private constructor();
|
|
1699
|
+
/**
|
|
1700
|
+
* Splits an HTTP header by one or more separators.
|
|
1701
|
+
*
|
|
1702
|
+
* Example:
|
|
1703
|
+
* HeaderUtility.split('da, en-gb;q=0.8', ',;')
|
|
1704
|
+
* // returns [['da'], ['en-gb', 'q=0.8']]
|
|
1705
|
+
*/
|
|
1706
|
+
static split(header: string, separators: string): string[][];
|
|
1707
|
+
/**
|
|
1708
|
+
* Combines an array of arrays into one associative object.
|
|
1709
|
+
* [['foo', 'abc'], ['bar']] => { foo: 'abc', bar: true }
|
|
1710
|
+
*/
|
|
1711
|
+
static combine(parts: (string | true)[][]): Record<string, string | boolean>;
|
|
1712
|
+
/**
|
|
1713
|
+
* Joins an associative object into a string for use in an HTTP header.
|
|
1714
|
+
* { foo: 'abc', bar: true, baz: 'a b c' } => 'foo=abc, bar, baz="a b c"'
|
|
1715
|
+
*/
|
|
1716
|
+
static toString(assoc: Record<string, string | boolean>, separator: string): string;
|
|
1717
|
+
/**
|
|
1718
|
+
* Encodes a string as a quoted string, if necessary.
|
|
1719
|
+
*/
|
|
1720
|
+
static quote(s: string): string;
|
|
1721
|
+
/**
|
|
1722
|
+
* Decodes a quoted string.
|
|
1723
|
+
*/
|
|
1724
|
+
static unquote(s: string): string;
|
|
1725
|
+
/**
|
|
1726
|
+
* Generates an HTTP Content-Disposition field-value.
|
|
1727
|
+
*
|
|
1728
|
+
* @see RFC 6266
|
|
1729
|
+
*/
|
|
1730
|
+
static makeDisposition(disposition: string, filename: string, filenameFallback?: string): string;
|
|
1731
|
+
/**
|
|
1732
|
+
* Like parse_str(), but preserves dots in variable names.
|
|
1733
|
+
*/
|
|
1734
|
+
static parseQuery(query: string, ignoreBrackets?: boolean, separator?: string): Record<string, any>;
|
|
1735
|
+
private static groupParts;
|
|
1736
|
+
}
|
|
1737
|
+
//#endregion
|
|
1738
|
+
//#region src/Utilities/IpUtils.d.ts
|
|
1739
|
+
/**
|
|
1740
|
+
* Http utility functions for IP handling.
|
|
1741
|
+
*/
|
|
1742
|
+
declare class IpUtils {
|
|
1743
|
+
static readonly PRIVATE_SUBNETS: string[];
|
|
1744
|
+
private static checkedIps;
|
|
1745
|
+
private constructor();
|
|
1746
|
+
/**
|
|
1747
|
+
* Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets.
|
|
1748
|
+
*
|
|
1749
|
+
* @param requestIp
|
|
1750
|
+
* @param ips List of IPs or subnets (can be a string if only a single one)
|
|
1751
|
+
*/
|
|
1752
|
+
static checkIp(requestIp?: string, ips?: string | string[]): boolean;
|
|
1753
|
+
/**
|
|
1754
|
+
* Compares two IPv4 addresses or checks if one belongs to a CIDR subnet.
|
|
1755
|
+
*
|
|
1756
|
+
* @param requestIp
|
|
1757
|
+
* @param ip IPv4 address or subnet in CIDR notation
|
|
1758
|
+
*
|
|
1759
|
+
* @return bool Whether the request IP matches the IP, or whether the request IP is within the CIDR subnet
|
|
1760
|
+
*/
|
|
1761
|
+
static checkIp4(requestIp: string, ip: string): boolean;
|
|
1762
|
+
/**
|
|
1763
|
+
* Compares two IPv6 addresses or checks if one belongs to a CIDR subnet.
|
|
1764
|
+
*
|
|
1765
|
+
* @see https://github.com/dsp/v6tools
|
|
1766
|
+
*
|
|
1767
|
+
* @param requestIp
|
|
1768
|
+
* @param ip IPv6 address or subnet in CIDR notation
|
|
1769
|
+
*
|
|
1770
|
+
* @throws {RuntimeException} When IPV6 support is not enabled
|
|
1771
|
+
*/
|
|
1772
|
+
static checkIp6(requestIp: string, ip: string): boolean;
|
|
1773
|
+
/**
|
|
1774
|
+
* Anonymizes an IPv4/IPv6 by zeroing out trailing bytes.
|
|
1775
|
+
*
|
|
1776
|
+
* @param ip
|
|
1777
|
+
* @param v4Bytes
|
|
1778
|
+
* @param v6Bytes
|
|
1779
|
+
*/
|
|
1780
|
+
static anonymize(ip: string, v4Bytes?: number, v6Bytes?: number): string;
|
|
1781
|
+
/**
|
|
1782
|
+
* Checks if IP is within private subnets.
|
|
1783
|
+
*/
|
|
1784
|
+
static isPrivateIp(requestIp: string): boolean;
|
|
1785
|
+
private static isIPv4;
|
|
1786
|
+
private static isIPv6;
|
|
1787
|
+
private static ipv4ToLong;
|
|
1788
|
+
private static inetPton;
|
|
1789
|
+
private static inetPton4;
|
|
1790
|
+
private static inetPton6;
|
|
1791
|
+
private static inetNtop;
|
|
1792
|
+
private static getCacheResult;
|
|
1793
|
+
private static setCacheResult;
|
|
1794
|
+
}
|
|
1795
|
+
//#endregion
|
|
1796
|
+
//#region src/Utilities/ResponseUtilities.d.ts
|
|
1797
|
+
declare enum ResponseCodes {
|
|
1798
|
+
HTTP_CONTINUE = 100,
|
|
1799
|
+
HTTP_SWITCHING_PROTOCOLS = 101,
|
|
1800
|
+
HTTP_PROCESSING = 102,
|
|
1801
|
+
// RFC2518
|
|
1802
|
+
HTTP_EARLY_HINTS = 103,
|
|
1803
|
+
// RFC8297
|
|
1804
|
+
HTTP_OK = 200,
|
|
1805
|
+
HTTP_CREATED = 201,
|
|
1806
|
+
HTTP_ACCEPTED = 202,
|
|
1807
|
+
HTTP_NON_AUTHORITATIVE_INFORMATION = 203,
|
|
1808
|
+
HTTP_NO_CONTENT = 204,
|
|
1809
|
+
HTTP_RESET_CONTENT = 205,
|
|
1810
|
+
HTTP_PARTIAL_CONTENT = 206,
|
|
1811
|
+
HTTP_MULTI_STATUS = 207,
|
|
1812
|
+
// RFC4918
|
|
1813
|
+
HTTP_ALREADY_REPORTED = 208,
|
|
1814
|
+
// RFC5842
|
|
1815
|
+
HTTP_IM_USED = 226,
|
|
1816
|
+
// RFC3229
|
|
1817
|
+
HTTP_MULTIPLE_CHOICES = 300,
|
|
1818
|
+
HTTP_MOVED_PERMANENTLY = 301,
|
|
1819
|
+
HTTP_FOUND = 302,
|
|
1820
|
+
HTTP_SEE_OTHER = 303,
|
|
1821
|
+
HTTP_NOT_MODIFIED = 304,
|
|
1822
|
+
HTTP_USE_PROXY = 305,
|
|
1823
|
+
HTTP_RESERVED = 306,
|
|
1824
|
+
HTTP_TEMPORARY_REDIRECT = 307,
|
|
1825
|
+
HTTP_PERMANENTLY_REDIRECT = 308,
|
|
1826
|
+
// RFC7238
|
|
1827
|
+
HTTP_BAD_REQUEST = 400,
|
|
1828
|
+
HTTP_UNAUTHORIZED = 401,
|
|
1829
|
+
HTTP_PAYMENT_REQUIRED = 402,
|
|
1830
|
+
HTTP_FORBIDDEN = 403,
|
|
1831
|
+
HTTP_NOT_FOUND = 404,
|
|
1832
|
+
HTTP_METHOD_NOT_ALLOWED = 405,
|
|
1833
|
+
HTTP_NOT_ACCEPTABLE = 406,
|
|
1834
|
+
HTTP_PROXY_AUTHENTICATION_REQUIRED = 407,
|
|
1835
|
+
HTTP_REQUEST_TIMEOUT = 408,
|
|
1836
|
+
HTTP_CONFLICT = 409,
|
|
1837
|
+
HTTP_GONE = 410,
|
|
1838
|
+
HTTP_LENGTH_REQUIRED = 411,
|
|
1839
|
+
HTTP_PRECONDITION_FAILED = 412,
|
|
1840
|
+
HTTP_REQUEST_ENTITY_TOO_LARGE = 413,
|
|
1841
|
+
HTTP_REQUEST_URI_TOO_LONG = 414,
|
|
1842
|
+
HTTP_UNSUPPORTED_MEDIA_TYPE = 415,
|
|
1843
|
+
HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
|
1844
|
+
HTTP_EXPECTATION_FAILED = 417,
|
|
1845
|
+
HTTP_I_AM_A_TEAPOT = 418,
|
|
1846
|
+
// RFC2324
|
|
1847
|
+
HTTP_MISDIRECTED_REQUEST = 421,
|
|
1848
|
+
// RFC7540
|
|
1849
|
+
HTTP_UNPROCESSABLE_ENTITY = 422,
|
|
1850
|
+
// RFC4918
|
|
1851
|
+
HTTP_LOCKED = 423,
|
|
1852
|
+
// RFC4918
|
|
1853
|
+
HTTP_FAILED_DEPENDENCY = 424,
|
|
1854
|
+
// RFC4918
|
|
1855
|
+
HTTP_TOO_EARLY = 425,
|
|
1856
|
+
// RFC-ietf-httpbis-replay-04
|
|
1857
|
+
HTTP_UPGRADE_REQUIRED = 426,
|
|
1858
|
+
// RFC2817
|
|
1859
|
+
HTTP_PRECONDITION_REQUIRED = 428,
|
|
1860
|
+
// RFC6585
|
|
1861
|
+
HTTP_TOO_MANY_REQUESTS = 429,
|
|
1862
|
+
// RFC6585
|
|
1863
|
+
HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
|
|
1864
|
+
// RFC6585
|
|
1865
|
+
HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451,
|
|
1866
|
+
// RFC7725
|
|
1867
|
+
HTTP_INTERNAL_SERVER_ERROR = 500,
|
|
1868
|
+
HTTP_NOT_IMPLEMENTED = 501,
|
|
1869
|
+
HTTP_BAD_GATEWAY = 502,
|
|
1870
|
+
HTTP_SERVICE_UNAVAILABLE = 503,
|
|
1871
|
+
HTTP_GATEWAY_TIMEOUT = 504,
|
|
1872
|
+
HTTP_VERSION_NOT_SUPPORTED = 505,
|
|
1873
|
+
HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506,
|
|
1874
|
+
// RFC2295
|
|
1875
|
+
HTTP_INSUFFICIENT_STORAGE = 507,
|
|
1876
|
+
// RFC4918
|
|
1877
|
+
HTTP_LOOP_DETECTED = 508,
|
|
1878
|
+
// RFC5842
|
|
1879
|
+
HTTP_NOT_EXTENDED = 510,
|
|
1880
|
+
// RFC2774
|
|
1881
|
+
HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511,
|
|
1882
|
+
}
|
|
1883
|
+
declare const HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES: CacheOptions;
|
|
1884
|
+
/**
|
|
1885
|
+
* Status codes translation table.
|
|
1886
|
+
*
|
|
1887
|
+
* The list of codes is complete according to the
|
|
1888
|
+
* @link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml Hypertext Transfer Protocol (HTTP) Status Code Registry
|
|
1889
|
+
* (last updated 2021-10-01).
|
|
1890
|
+
*
|
|
1891
|
+
* Unless otherwise noted, the status code is defined in RFC2616.
|
|
1892
|
+
*/
|
|
1893
|
+
declare const statusTexts: {
|
|
1894
|
+
[key: number]: string;
|
|
1895
|
+
};
|
|
1896
|
+
//#endregion
|
|
1897
|
+
export { ApiResource, BadRequestException, CacheOptions, ConflictingHeadersException, Cookie, FileBag, FireCommand, FormRequest, HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES, HeaderBag, HeaderUtility, HttpContext, HttpRequest, HttpResponse, HttpResponseException, HttpServiceProvider, InputBag, IpUtils, JsonResource, LogRequests, Middleware, ParamBag, Request, Resource, Response, ResponseCodes, ResponseHeaderBag, ServerBag, SuspiciousOperationException, UnexpectedValueException, UploadedFile, statusTexts };
|