@ublitzjs/core 0.0.1 → 0.1.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.
@@ -19,25 +19,26 @@ class HeadersMap extends Map {
19
19
  super();
20
20
  this.currentHeaders = opts;
21
21
  }
22
- remove(...keys) {
23
- keys.forEach((key) => delete this.currentHeaders[key]);
22
+ remove(keys) {
23
+ for (const key of arguments) delete this.currentHeaders[key];
24
24
  return this;
25
25
  }
26
26
  prepare() {
27
27
  for (const key in this.currentHeaders)
28
28
  this.set(toAB(key), toAB(this.currentHeaders[key]));
29
- return (this.currentHeaders = void 0), (res) => this.toRes(res);
29
+ return delete this.currentHeaders, (res) => this.toRes(res);
30
+ }
31
+ toRes(res) {
32
+ for (const pair of this) res.writeHeader(pair[0], pair[1]);
33
+ return res;
30
34
  }
31
- toRes = (res) =>
32
- res.cork(() => this.forEach((value, key) => res.writeHeader(key, value)));
33
35
  static baseObj = helmetHeaders;
34
- static default = new HeadersMap({ ...HeadersMap.baseObj }).prepare();
35
36
  }
36
37
  function setCSP(mainCSP, ...remove) {
37
- var key;
38
38
  var CSPstring = "";
39
- remove.forEach((dir) => delete mainCSP[dir]);
40
- for (key in mainCSP) CSPstring += `${key} ${mainCSP[key].join(" ")}; `;
39
+ for (const dir of remove) delete mainCSP[dir];
40
+ for (var key in mainCSP)
41
+ CSPstring += key + " " + mainCSP[key].join(" ") + "; ";
41
42
  return CSPstring;
42
43
  }
43
44
  var CSPDirs = {
@@ -19,24 +19,26 @@ class HeadersMap extends Map {
19
19
  super();
20
20
  this.currentHeaders = opts;
21
21
  }
22
- remove(...keys) {
23
- return keys.forEach((key) => delete this.currentHeaders[key]), this;
22
+ remove(keys) {
23
+ for (const key of arguments) delete this.currentHeaders[key];
24
+ return this;
24
25
  }
25
26
  prepare() {
26
27
  for (const key in this.currentHeaders)
27
28
  this.set(toAB(key), toAB(this.currentHeaders[key]));
28
- return (this.currentHeaders = void 0), (res) => this.toRes(res);
29
+ return delete this.currentHeaders, (res) => this.toRes(res);
30
+ }
31
+ toRes(res) {
32
+ for (var pair of this) res.writeHeader(pair[0], pair[1]);
33
+ return res;
29
34
  }
30
- toRes = (res) =>
31
- res.cork(() => this.forEach((value, key) => res.writeHeader(key, value)));
32
35
  static baseObj = helmetHeaders;
33
- static default = new HeadersMap({ ...HeadersMap.baseObj }).prepare();
34
36
  }
35
37
  function setCSP(mainCSP, ...remove) {
36
- var key;
37
38
  var CSPstring = "";
38
- remove.forEach((dir) => delete mainCSP[dir]);
39
- for (key in mainCSP) CSPstring += `${key} ${mainCSP[key].join(" ")}; `;
39
+ for (const dir of remove) delete mainCSP[dir];
40
+ for (var key in mainCSP)
41
+ CSPstring += key + " " + mainCSP[key].join(" ") + "; ";
40
42
  return CSPstring;
41
43
  }
42
44
  var CSPDirs = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ublitzjs/core",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "exports": {
5
5
  "types": "./types/index.d.ts",
6
6
  "require": "./cjs/index.cjs",
@@ -8,14 +8,16 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "tseep": "^1.3.1",
11
- "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.52.0"
11
+ "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.56.0"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
12
15
  },
13
- "publishConfig": {"access": "public"},
14
16
  "devDependencies": {
15
- "undici": "^7.10.0",
16
- "esbuild": "^0.25.4",
17
- "vitest": "^3.1.1",
18
- "ws": "^8.18.2"
17
+ "undici": "^7.16.0",
18
+ "esbuild": "^0.25.12",
19
+ "vitest": "^4.0.8",
20
+ "ws": "^8.18.3"
19
21
  },
20
22
  "repository": {
21
23
  "type": "git",
@@ -25,5 +27,16 @@
25
27
  "url": "https://github.com/ublitzjs/core/issues",
26
28
  "email": "diril656@gmail.com"
27
29
  },
28
- "homepage": "https://github.com/ublitzjs/core#readme"
30
+ "homepage": "https://github.com/ublitzjs/core#readme",
31
+ "keywords": [
32
+ "ublitzjs",
33
+ "uWebSockets.js",
34
+ "uws",
35
+ "documentation",
36
+ "http",
37
+ "headers",
38
+ "codes",
39
+ "development",
40
+ "asynchronous code"
41
+ ]
29
42
  }
@@ -1,6 +1,29 @@
1
1
  import type { HttpResponse } from "./index";
2
2
  import type { HttpResponse as uwsHttpResponse } from "uWebSockets.js";
3
3
  type helmetHeadersT = {
4
+ /**
5
+ * By adding this header you can declare that your site should only load resources that have explicitly opted-in to being loaded across origins.
6
+ * "require-corp" LETS YOU USE new SharedArrayBuffer()
7
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cross-Origin-Embedder-Policy
8
+ */
9
+ "Cross-Origin-Embedder-Policy":
10
+ | "unsafe-none"
11
+ | "require-corp"
12
+ | "credentialless";
13
+ /**
14
+ * whether new page opened via Window.open() should be treated differently for performance reasons
15
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cross-Origin-Opener-Policy
16
+ */
17
+ "Cross-Origin-Opener-Policy":
18
+ | "unsafe-none"
19
+ | "same-origin-allow-popups"
20
+ | "same-origin"
21
+ | "noopener-allow-popups";
22
+ /**
23
+ * From where should client fetch resources
24
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cross-Origin-Resource-Policy
25
+ */
26
+ "Cross-Origin-Resource-Policy": "same-site" | "same-origin" | "cross-origin";
4
27
  /**
5
28
  * if client fetched resource, but its MIME type is different - abort request
6
29
  */
@@ -39,121 +62,890 @@ type helmetHeadersT = {
39
62
  * Whether downloaded files should be run on the client side immediately. For IE8
40
63
  */
41
64
  "X-Download-Options": "noopen";
65
+
42
66
  /**
43
- * From where should client fetch resources
67
+ * similar to COOP, where ?1 is true
44
68
  */
45
- "Cross-Origin-Resource-Policy": "same-site" | "same-origin" | "cross-origin";
69
+ "Origin-Agent-Cluster": "?0" | "?1";
46
70
  /**
47
- * whether new page opened via Window.open() should be treated differently for performance reasons
71
+ *@deprecated
72
+ * */
73
+ "X-XSS-Protection": string;
74
+ };
75
+ type CORSHeader = {
76
+ /**
77
+ * The HTTP Access-Control-Allow-Credentials response header tells browsers whether the server allows credentials to be included in cross-origin HTTP requests.
78
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Credentials
48
79
  */
49
- "Cross-Origin-Opener-Policy":
50
- | "unsafe-none"
51
- | "same-origin-allow-popups"
52
- | "same-origin"
53
- | "noopener-allow-popups";
80
+ "Access-Control-Allow-Credentials": "true" | "false";
54
81
  /**
55
- * By adding this header you can declare that your site should only load resources that have explicitly opted-in to being loaded across origins.
56
- * "require-corp" LETS YOU USE new SharedArrayBuffer()
82
+ * Allowed headers in the request.
83
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Headers
57
84
  */
58
- "Cross-Origin-Embedder-Policy":
59
- | "unsafe-none"
60
- | "require-corp"
61
- | "credentialless";
85
+ "Access-Control-Allow-Headers": string;
62
86
  /**
63
- * similar to COOP, where ?1 is true
87
+ * CORS version of Allow header
88
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Methods
64
89
  */
65
- "Origin-Agent-Cluster": "?0" | "?1";
66
- };
67
- type allHeaders = {
90
+ "Access-Control-Allow-Methods": string;
68
91
  /**
69
- * Headers, which may change for different responses. Use the same value for all methods of a given url.
70
- * @example
71
- * "Content-Type, Content-Length"
92
+ * Allowed origins to get the resource. * - all, https://example.com - some website.
93
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Origin
72
94
  */
73
- Vary: string;
95
+ "Access-Control-Allow-Origin": string;
74
96
  /**
75
- * confirms that client "really wants" to request that an HTTP client is upgraded to become a WebSocket.
97
+ * The HTTP Access-Control-Expose-Headers response header allows a server to indicate which response headers should be made available to scripts running in the browser in response to a cross-origin request.
98
+
99
+ * Only the CORS-safelisted response headers are exposed by default. For clients to be able to access other headers, the server must list them using the Access-Control-Expose-Headers header.
100
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Expose-Headers
101
+ */
102
+ "Access-Control-Expose-Headers": string;
103
+ /**
104
+ * The HTTP Access-Control-Max-Age response header indicates how long the results of a preflight request (that is, the information contained in the Access-Control-Allow-Methods and Access-Control-Allow-Headers headers) can be cached.
105
+ * @example "600"
106
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Max-Age
76
107
  */
77
- "Sec-Websocket-Key": string;
108
+ "Access-Control-Max-Age": string;
78
109
  /**
79
- * protocol you are communicating by using WebSockets
80
- * @see https://www.iana.org/assignments/websocket/websocket.xml#subprotocol-name
110
+ * The HTTP Access-Control-Request-Headers request header is used by browsers when issuing a preflight request to let the server know which HTTP headers the client might send when the actual request is made (such as with fetch() or XMLHttpRequest.setRequestHeader()).
111
+ *
112
+ * The complementary server-side header of Access-Control-Allow-Headers will answer this browser-side header.
113
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Request-Headers
81
114
  */
82
- "Sec-Websocket-Protocol": string;
83
- "Sec-Websocket-Extensions": string;
84
- Server: string;
85
- "Set-Cookie": string;
86
- Upgrade: string;
87
- "User-Agent": string;
88
- Origin: string;
89
- Range: string;
90
- Location: string;
91
- "Last-Modified": string;
92
- Host: string;
93
- Forwarded: string;
94
- Cookie: string;
95
- Allow: string;
96
115
  "Access-Control-Request-Headers": string;
116
+ /**
117
+ * The HTTP Access-Control-Request-Method request header is used by browsers when issuing a preflight request to let the server know which HTTP method will be used when the actual request is made. This header is necessary because the preflight request is always an OPTIONS and doesn't use the same method as the actual request.
118
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Request-Method
119
+ */
97
120
  "Access-Control-Request-Method": string;
121
+ };
122
+ type experimentalHeaders = {
123
+ /**
124
+ * @experimental
125
+ * The HTTP Attribution-Reporting-Eligible request header indicates that the corresponding response is eligible to register an attribution source or trigger.
126
+
127
+ This header is never set manually and is instead sent by the browser in response to various HTML element or JavaScript request settings.
128
+
129
+ Depending on the allowed registrations specified in the Attribution-Reporting-Eligible value, the server is expected to respond with either an Attribution-Reporting-Register-Source or Attribution-Reporting-Register-Trigger header to complete the registration of an attribution source or trigger, respectively.
130
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Attribution-Reporting-Eligible
131
+ */
132
+ "Attribution-Reporting-Eligible": string;
133
+ /**
134
+ * @experimental
135
+ * The HTTP Attribution-Reporting-Register-Source response header registers a page feature as an attribution source.
136
+ *
137
+ * This header is included as part of a response to a request that contains the Attribution-Reporting-Eligible header.
138
+ *
139
+ * It provides the information that the browser should store when a user interacts with the attribution source.
140
+ *
141
+ * The information you include in this header also determines the types of reports the browser can generate.
142
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Attribution-Reporting-Register-Source
143
+ */
144
+ "Attribution-Reporting-Register-Source": string;
145
+ /**
146
+ * @experimental
147
+ * The HTTP Attribution-Reporting-Register-Trigger response header registers a page feature as an attribution trigger.
148
+ *
149
+ * This header is included as part of a response to a request that contains the Attribution-Reporting-Eligible header.
150
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Attribution-Reporting-Register-Trigger
151
+ */
152
+ "Attribution-Reporting-Register-Trigger": string;
153
+ /**
154
+ * @experimental
155
+ * The HTTP Available-Dictionary request header allows the browser to specify the best matching dictionary it has to allow the server to use Compression Dictionary Transport for a resource request.
156
+
157
+ Clients can send an Available-Dictionary header when they support dcb or dcz encodings.
158
+
159
+ The header is a colon-surrounded base-64 encoded SHA-256 hash of the dictionary contents.
160
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Available-Dictionary
161
+ */
162
+ "Available-Dictionary": string;
163
+ /**
164
+ * @experimental
165
+ * The HTTP Critical-CH response header is used along with Accept-CH to identify the accepted client hints that are critical.
166
+
167
+ User agents receiving a response with Critical-CH must check if the indicated critical headers were sent in the original request.
168
+
169
+ If not, the user agent will retry the request along with the critical headers rather than render the page.
170
+
171
+ This approach ensures that client preferences set using critical client hints are always used, even if not included in the first request, or following server configuration changes.
172
+
173
+ Each header listed in the Critical-CH header should also be present in the Accept-CH and Vary headers.
174
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Critical-CH
175
+ */
176
+ "Critical-CH": string;
177
+ /**
178
+ * @experimental
179
+ * The HTTP Dictionary-ID request header references a dictionary that can be used in Compression Dictionary Transport to compress the server's response.
180
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Dictionary-ID
181
+ **/
182
+ "Dictionary-ID": string;
183
+ /**
184
+ * @experimental10
185
+ * The HTTP Device-Memory request header is used in device client hints to indicate the approximate amount of available RAM on the client device, in gigabytes. The header is part of the Device Memory API.
186
+
187
+ Client hints are accessible only on secure origins.
188
+
189
+ A server has to opt in to receive the Device-Memory header from the client, by first sending the Accept-CH response header.
190
+
191
+ Servers that opt in to the Device-Memory client hint will typically also specify it in the Vary header to inform caches that the server may send different responses based on the header value in a request.
192
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Device-Memory
193
+ */
194
+ "Device-Memory": string;
195
+ /**
196
+ * @deprecated
197
+ * @experimental
198
+ * The HTTP DNT (Do Not Track) request header indicates the user's tracking preference.
199
+ *
200
+ * It lets users indicate whether they would prefer privacy rather than personalized content.
201
+
202
+ DNT is deprecated in favor of Global Privacy Control, which is communicated to servers using the Sec-GPC header, and accessible to clients from navigator.globalPrivacyControl.
203
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/DNT
204
+ **/
205
+ DNT: string;
206
+ /**
207
+ * The HTTP Downlink request header is used in Client Hints to provide the approximate bandwidth in Mbps of the client's connection to the server.
208
+
209
+ The hint allows a server to choose what information is sent based on the network bandwidth.
210
+
211
+ For example, a server might choose to send smaller versions of images and other resources on low bandwidth networks.
212
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Downlink
213
+ **/
214
+ Downlink: string;
215
+ /**
216
+ * @deprecated
217
+ * The HTTP DPR request header provides device client hints about the client device pixel ratio (DPR). This ratio is the number of physical device pixels corresponding to every CSS pixel.
218
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/DPR
219
+ **/
220
+ DPR: string;
221
+ /**
222
+ * @experimental
223
+ * The HTTP Early-Data request header is set by an intermediary to indicate that the request has been conveyed in TLS early data, and also indicates that the intermediary understands the 425 Too Early status code.
224
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Early-Data
225
+ * */
226
+ "Early-Data": string;
227
+ /**
228
+ * @experimental
229
+ *The HTTP ECT request header is used in Client Hints to indicate the effective connection type: slow-2g, 2g, 3g, or 4g.
230
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ECT
231
+ * */
232
+ ECT: string;
233
+ /**
234
+ * @experimental
235
+ * The HTTP NEL response header is used to configure network request logging.
236
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/NEL
237
+ * */
238
+ NEL: string;
239
+ /**
240
+ *@experimental
241
+ The HTTP No-Vary-Search response header specifies a set of rules that define how a URL's query parameters will affect cache matching.
242
+
243
+ These rules dictate whether the same URL with different URL parameters should be saved as separate browser cache entries.A
244
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/No-Vary-Search
245
+ * */
246
+ "No-Vary-Search": string;
247
+ /**
248
+ *@experimental
249
+ * The HTTP Observe-Browsing-Topics response header is used to mark topics of interest inferred from a calling site's URL (i.e., the site where the ad tech <iframe> is embedded) as observed in the response to a request generated by a feature that enables the Topics API. The browser will subsequently use those topics to calculate top topics for the current user for future epochs.
250
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Observe-Browsing-Topics
251
+ * */
252
+ "Observe-Browsing-Topics": string;
253
+ /**
254
+ * @experimental
255
+ *The HTTP Permissions-Policy response header provides a mechanism to allow and deny the use of browser features in a document or within any <iframe> elements in the document.
256
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Permissions-Policy
257
+ * */
258
+ "Permissions-Policy": string;
259
+ /**
260
+ *@experimental
261
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/RTT
262
+ * */
263
+ RTT: string;
264
+ /**
265
+ *@experimental
266
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/RTT
267
+ * */
268
+ "Save-Data": string;
269
+ /**
270
+ *@experimental
271
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Browsing-Topics
272
+ * */
273
+ "Sec-Browsing-Topics": string;
274
+ /**
275
+ *@experimental
276
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-Prefers-Color-Scheme
277
+ * */
278
+ "Sec-CH-Prefers-Color-Scheme": string;
279
+ /**
280
+ * @experimental
281
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-Prefers-Reduced-Motion
282
+ * */
283
+ "Sec-CH-Prefers-Reduced-Motion": string;
284
+ /**
285
+ *@experimental
286
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-Prefers-Reduced-Transparency
287
+ * */
288
+ "Sec-CH-Prefers-Reduced-Transparency": string;
289
+ /**
290
+ *@experimental
291
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA
292
+ * */
293
+ "Sec-CH-UA": string;
294
+ /**
295
+ * @experimental
296
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Arch
297
+ * */
298
+ "Sec-CH-UA-Arch": string;
299
+ /**
300
+ * @experimental
301
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Bitness
302
+ * */
303
+ "Sec-CH-UA-Bitness": string;
304
+ /**
305
+ *@experimental
306
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Form-Factors
307
+ * */
308
+ "Sec-CH-UA-Form-Factors": string;
309
+ /**
310
+ *@deprecated
311
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Full-Version
312
+ * */
313
+ "Sec-CH-UA-Full-Version": string;
314
+ /**
315
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Full-Version-List
316
+ @experimental
317
+ * */
318
+ "Sec-CH-UA-Full-Version-List": string;
319
+ /**
320
+ *@experimental
321
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Mobile
322
+ * */
323
+ "Sec-CH-UA-Mobile": string;
324
+ /**
325
+ *@experimental
326
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Model
327
+ * */
328
+ "Sec-CH-UA-Model": string;
329
+ /**
330
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Platform
331
+ @experimental
332
+ * */
333
+ "Sec-CH-UA-Platform": string;
334
+ /**
335
+ *@experimental
336
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-Platform-Version
337
+ * */
338
+ "Sec-CH-UA-Platform-Version": string;
339
+
340
+ /**
341
+ *@experimental
342
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-CH-UA-WoW64
343
+ * */
344
+ "Sec-CH-UA-WoW64": string;
345
+ /**
346
+ *@experimental
347
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-GPC
348
+ * */
349
+ "Sec-GPC": string;
350
+ /**
351
+ *@experimental
352
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Speculation-Tags
353
+ * */
354
+ "Sec-Speculation-Tags": string;
355
+ /**
356
+ *@experimental
357
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Purpose
358
+ * */
359
+ "Sec-Purpose": string;
360
+ /**
361
+ * @experimental
362
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Speculation-Rules
363
+ The HTTP Speculation-Rules response header provides one or more URLs pointing to text resources containing speculation rule JSON definitions. When the response is an HTML document, these rules will be added to the document's speculation rule set. See the Speculation Rules API for more information.
364
+ * */
365
+ "Speculation-Rules": string;
366
+ /**
367
+ * @experimental
368
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Supports-Loading-Mode
369
+ * */
370
+ "Supports-Loading-Mode": string;
371
+ /**
372
+ * @experimental
373
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Use-As-Dictionary
374
+ * */
375
+ "Use-As-Dictionary": string;
376
+ };
377
+ type simpleHeaders = {
98
378
  /**
99
379
  * indicates which content types, expressed as MIME types, the sender is able to understand
380
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept
100
381
  */
101
382
  Accept: string;
102
383
  /**
103
- * You know this one. It is "text/html" or "video/mp4" or whatever
384
+ * The HTTP Accept-CH response header may be set by a server to specify which client hint headers should be included by the client in subsequent requests. To ensure client hints are sent reliably, the Accept-CH header should be persisted for all secure requests.
385
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-CH
104
386
  */
105
- "Content-Type": string;
387
+ "Accept-CH": string;
388
+ /**
389
+ * The HTTP Accept-Encoding request and response header indicates the content encoding (usually a compression algorithm) that the sender can understand.
390
+ *
391
+ * In requests, the server uses content negotiation to select one of the encoding proposals from the client and informs the client of that choice with the Content-Encoding response header.
392
+ *
393
+ * In responses, it provides information about which content encodings the server can understand in messages to the requested resource, so that the encoding can be used in subsequent requests to the resource.
394
+ *
395
+ * For example, Accept-Encoding is included in a 415 Unsupported Media Type response if a request to a resource (e.g., PUT) used an unsupported encoding.
396
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Encoding
397
+ */
398
+ "Accept-Encoding": string;
399
+ /**
400
+ * The HTTP Accept-Language request header indicates the natural language and locale that the client prefers.\
401
+ * The server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Language response header.
402
+ *
403
+ * Browsers set required values for this header according to their active user interface language.\
404
+ * Users can also configure additional preferred languages through browser settings.
405
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Language
406
+ */
407
+ "Accept-Language": string;
408
+ /**
409
+ * The HTTP Accept-Patch response header advertises which media types the server is able to understand in a PATCH request. For example, a server receiving a PATCH request with an unsupported media type could reply with 415 Unsupported Media Type and an Accept-Patch header referencing one or more supported media types.
410
+
411
+ * The header should appear in OPTIONS requests to a resource that supports the PATCH method. An Accept-Patch header in a response to any request method implicitly means that a PATCH is allowed on the target resource in the request.
412
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Patch
413
+ */
414
+ "Accept-Patch": string;
415
+ /**
416
+ * The HTTP Accept-Post response header advertises which media types are accepted by the server in a POST request. For example, a server receiving a POST request with an unsupported media type could reply with 415 Unsupported Media Type and an Accept-Post header referencing one or more supported media types.
417
+
418
+ * The header should appear in OPTIONS requests to a resource that supports the POST method. An Accept-Post header in a response to any request method implicitly means that a POST is allowed on the target resource in the request.
419
+ @example
420
+ "application/json"
421
+ "image/webp, text/plain"
422
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Post
423
+ */
424
+ "Accept-Post": string;
425
+ /**
426
+ * The HTTP Accept-Ranges response header is used by the server to advertise its support for range requests, allowing clients to request part or several parts of a resource. The value of this header indicates the unit that can be used to define a range.
427
+
428
+ * For example, a response with an Accept-Ranges header indicates that the server is capable of resuming an interrupted download instead of a client restarting the transfer in full.
429
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Ranges
430
+ */
431
+ "Accept-Ranges": "bytes" | "none";
432
+ /**
433
+ * The HTTP Age response header indicates the time in seconds for which an object was in a proxy cache.
434
+
435
+ * The header value is usually close to zero. If the value is 0, the object was probably fetched from the origin server; otherwise, the value is usually calculated as a difference between the proxy's current date and the Date general header included in the HTTP response.
436
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Age
437
+ */
438
+ Age: string;
439
+ /**
440
+ * The HTTP Allow response header lists the set of request methods supported by a resource.
441
+ *
442
+ * This header must be sent if the server responds with a 405 Method Not Allowed status code to indicate which request methods can be used instead.
443
+ *
444
+ * An empty Allow value indicates that the resource allows no request methods, which might occur temporarily for a given resource.
445
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Allow
446
+ */
447
+ Allow: string;
448
+ /**
449
+ * The HTTP Alt-Svc response header lets a server indicate that another network location (the "alternative service") can be treated as authoritative for that origin when making future requests.
450
+
451
+ Doing so allows new protocol versions to be advertised without affecting in-flight requests and can also help servers manage traffic.
452
+
453
+ Using an alternative service is not visible to the end user; it does not change the URL or the origin of the request and does not introduce additional round trips.
454
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Alt-Svc
455
+ */
456
+ "Alt-Svc": string;
457
+ /**
458
+ * The HTTP Alt-Used request header is used to identify the alternative service in use, just as the Host HTTP header field identifies the host and port of the origin.
459
+
460
+ The is intended to allow alternative services to detect loops, differentiate traffic for purposes of load balancing, and generally to ensure that it is possible to identify the intended destination of traffic, since introducing this information after a protocol is in use has proven to be problematic.
461
+
462
+ When a client uses an alternative service for a request, it can indicate this to the server using the Alt-Used HTTP header.
463
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Alt-Used
464
+ */
465
+ "Alt-Used": string;
466
+ /**
467
+ * The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to protected resources.
468
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Authorization
469
+ */
470
+ Authorization: string;
471
+ /**
472
+ *The HTTP Cache-Control header holds directives (instructions) in both requests and responses that control caching in browsers and shared caches (e.g., Proxies, CDNs).
473
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control
474
+ */
475
+ "Cache-Control": string;
476
+ /**
477
+ * The HTTP Clear-Site-Data response header sends a signal to the client that it should remove all browsing data of certain types (cookies, storage, cache) associated with the requesting website.
478
+ *
479
+ * It allows web developers to have more control over the data stored by browsers for their origins.
480
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Clear-Site-Data
481
+ */
482
+ "Clear-Site-Data": string;
483
+ /**
484
+ * The HTTP Connection header controls whether the network connection stays open after the current transaction finishes.
485
+ *
486
+ * If the value sent is keep-alive, the connection is persistent and not closed, allowing subsequent requests to the same server on the same connection.
487
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Connection
488
+ */
489
+ Connection: string;
490
+ /**
491
+ * The HTTP Content-Digest request and response header provides a digest calculated using a hashing algorithm applied to the message content.
492
+ *
493
+ * A recipient can use the Content-Digest to validate the HTTP message content for integrity purposes.
494
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Digest
495
+ */
496
+ "Content-Digest": string;
497
+ /**
498
+ * The HTTP Content-Disposition header indicates whether content should be displayed inline in the browser as a web page or part of a web page or downloaded as an attachment locally.
499
+ *
500
+ * In a multipart body, the header must be used on each subpart to provide information about its corresponding field.
501
+ *
502
+ * The subpart is delimited by the boundary defined in the Content-Type header. When used on the body itself, Content-Disposition has no effect.
503
+
504
+ The Content-Disposition header is defined in the larger context of MIME messages for email, but only a subset of the possible parameters apply to HTTP forms and POST requests.
505
+
506
+ Only the value form-data, as well as the optional directive name and filename, can be used in the HTTP context.
507
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Disposition
508
+ */
509
+ "Content-Disposition": string;
510
+ /**
511
+ * @deprecated
512
+ * The HTTP Content-DPR response header is used to confirm the image device to pixel ratio (DPR) in requests where the screen DPR client hint was used to select an image resource.
513
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-DPR
514
+ */
515
+ "Content-DPR": string;
516
+ /**
517
+ * The HTTP Content-Encoding representation header lists the encodings and the order in which they have been applied to a resource.
518
+ *
519
+ * This lets the recipient know how to decode the data in order to obtain the original content format described in the Content-Type header.
520
+ *
521
+ * Content encoding is mainly used to compress content without losing information about the original media type.
522
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Encoding
523
+ */
524
+ "Content-Encoding": string;
525
+ /**
526
+ * The HTTP Content-Language representation header is used to describe the language(s) intended for the audience, so users can differentiate it according to their own preferred language.
527
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Language
528
+ */
529
+ "Content-Language": string;
106
530
  /**
107
531
  * Length in bytes of content, you send or receive.
108
532
  * @type number. BUT here it is a string
109
533
  */
110
534
  "Content-Length": string;
111
535
  /**
112
- * get it from setCSP()
536
+ * The HTTP Content-Location representation header indicates an alternate location for the returned data.
537
+ *
538
+ * It's main use is to indicate the URL of a resource transmitted as the result of content negotiation.
539
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Location
540
+ */
541
+ "Content-Location": string;
542
+ /**
543
+ * The HTTP Content-Range response header is used in range requests to indicate where the content of a response body belongs in relation to a complete resource.
544
+
545
+ It should only be included in 206 Partial Content or 416 Range Not Satisfiable responses.
546
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Range
547
+ */
548
+ "Content-Range": string;
549
+ /**
550
+ * The HTTP Content-Security-Policy response header allows website administrators to control resources the user agent is allowed to load for a given page.
551
+ *
552
+ * With a few exceptions, policies mostly involve specifying server origins and script endpoints. This helps guard against cross-site scripting attacks.
553
+ *
554
+ * @use setCSP function
555
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy
113
556
  */
114
557
  "Content-Security-Policy": string;
115
- //"Content-Security-Policy-Report-Only":"",
116
- //"Strict-Transport-Security":`max-age=${60 * 60 * 24 * 365}; includeSubDomains`,
117
558
  /**
118
- * Allowed origins to get the resource. * - all, https://example.com - some website.
559
+ * The HTTP Content-Security-Policy-Report-Only response header helps to monitor Content Security Policy (CSP) violations and their effects without enforcing the security policies.
560
+ *
561
+ * This header allows you to test or repair violations before a specific Content-Security-Policy is applied and enforced.
562
+
563
+ The CSP report-to directive must be specified for reports to be sent: if not, the operation won't have any effect.
564
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy-Report-Only
119
565
  */
120
- "Access-Control-Allow-Origin": string;
566
+ "Content-Security-Policy-Report-Only": string;
121
567
  /**
122
- * Allowed headers in the request.
568
+ * You know this one. It is "text/html" or "video/mp4" or whatever
569
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Type
123
570
  */
124
- "Access-Control-Allow-Headers": string;
571
+ "Content-Type": string;
125
572
  /**
126
- * CORS version of Allow header
573
+ * The HTTP Cookie request header contains stored HTTP cookies associated with the server (i.e., previously sent by the server with the Set-Cookie header or set in JavaScript using Document.cookie)
574
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cookie
127
575
  */
128
- "Access-Control-Allow-Methods": string;
576
+ Cookie: string;
129
577
  /**
130
- * How much time the response should be cached.
131
- * 1) must-revalidate
132
- * 2) no-cache
133
- * 3) no-store
134
- * 4) no-transform
135
- * 5) public -> cached anyhow
136
- * 6) private
137
- * 7) proxy-revalidate
138
- * 8) max-age=<seconds>
139
- * 9) s-maxage=<seconds>;
140
- * @but those below aren't supported everywhere:
141
- * 1) immutable
142
- * 2) stale-while-revalidate=<seconds>
143
- * 3) stale-if-error=<seconds>
578
+ * The HTTP Date request and response header contains the date and time at which the message originated.
579
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Date
144
580
  */
145
- "Cache-Control": string;
146
- "Access-Control-Max-Age": string;
581
+ Date: string;
582
+
583
+ /**
584
+ * The HTTP ETag (entity tag) response header is an identifier for a specific version of a resource.
585
+ *
586
+ * It lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed.
587
+ *
588
+ * Additionally, ETags help to prevent simultaneous updates of a resource from overwriting each other ("mid-air collisions").
589
+ * If the resource at a given URL changes, a new Etag value must be generated. A comparison of them can determine whether two representations of a resource are the same.
590
+ * @see
591
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag
592
+ * */
593
+
594
+ Etag: string;
595
+ /**
596
+ *The HTTP Expect request header indicates that there are expectations that need to be met by the server in order to handle the complete request successfully.
597
+
598
+ When a request has an Expect: 100-continue header, a server sends a 100 Continue response to indicate that the server is ready or capable of receiving the rest of the request content. Waiting for a 100 response can be helpful if a client anticipates that an error is likely, for example, when sending state-changing operations without previously verified authentication credentials.
599
+
600
+ A 417 Expectation Failed response is returned if the server cannot meet the expectation, or any other status otherwise (e.g., a 4XX status for a client error, or a 2XX status if the request can be resolved successfully without further processing).
601
+
602
+ None of the more common browsers send the Expect header, but some clients (command-line tools) do so by default.
603
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Expect
604
+ * */
605
+ Expect: string;
606
+ /**
607
+ * @deprecated
608
+ * The Expect-CT response header lets sites opt in to reporting and/or enforcement of Certificate Transparency requirements. Certificate Transparency (CT) aims to prevent the use of misissued certificates for that site from going unnoticed.
609
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Expect-CT
610
+ * */
611
+ "Expect-CT": string;
612
+ /**
613
+ *The HTTP Expires response header contains the date/time after which the response is considered expired in the context of HTTP caching.
614
+
615
+ The value 0 is used to represent a date in the past, indicating the resource has already expired.
616
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Expires
617
+ * */
618
+ Expires: string;
619
+ /**
620
+ * The HTTP Forwarded request header contains information that may be added by reverse proxy servers (load balancers, CDNs, etc.) that would otherwise be altered or lost when proxy servers are involved in the path of the request.
621
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Forwarded
622
+ * */
623
+ Forwared: string;
624
+ /**
625
+ * The HTTP From request header contains an Internet email address for an administrator who controls an automated user agent.
626
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/From
627
+ * */
628
+ From: string;
629
+ /**
630
+ * The HTTP Host request header specifies the host and port number of the server to which the request is being sent.
631
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Host
632
+ * */
633
+ Host: string;
634
+ /**
635
+ * The HTTP If-Match request header makes a request conditional. A server will return resources for GET and HEAD methods, or upload resource for PUT and other non-safe methods, only if the resource matches one of the ETag values in the If-Match request header. If the conditional does not match, the 412 Precondition Failed response is returned instead.
636
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Match
637
+ * */
638
+ "If-Match": string;
639
+ /**
640
+ * The HTTP If-Modified-Since request header makes a request conditional. The server sends back the requested resource, with a 200 status, only if it has been modified after the date in the If-Modified-Since header. If the resource has not been modified since, the response is a 304 without any body, and the Last-Modified response header of the previous request contains the date of the last modification.
641
+
642
+ Unlike If-Unmodified-Since, If-Modified-Since can only be used with a GET or HEAD. When used in combination with If-None-Match, it is ignored, unless the server doesn't support If-None-Match.
643
+
644
+ The most common use case is to update a cached entity that has no associated ETag.
645
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Modified-Since
646
+ * */
647
+ "If-Modified-Since": string;
648
+ /**
649
+ *The HTTP If-None-Match request header makes a request conditional. The server returns the requested resource in GET and HEAD methods with a 200 status, only if it doesn't have an ETag matching the ones in the If-None-Match header. For other methods, the request will be processed only if the eventually existing resource's ETag doesn't match any of the values listed.
650
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-None-Match
651
+ * */
652
+ "If-None-Match": string;
653
+ /**
654
+ * The HTTP If-Range request header makes a range request conditional. If the condition is fulfilled, a range request is issued, and the server sends back a 206 Partial Content response with part (or parts) of the resource in the body. If the condition is not fulfilled, the full resource is sent back with a 200 OK status.
655
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Range
656
+ * */
657
+ "If-Range": string;
658
+ /**
659
+ *The HTTP If-Unmodified-Since request header makes the request for the resource conditional. The server will send the requested resource (or accept it in the case of a POST or another non-safe method) only if the resource on the server has not been modified after the date in the request header. If the resource has been modified after the specified date, the response will be a 412 Precondition Failed error.
660
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Unmodified-Since
661
+ * */
662
+ "If-Unmodified-Since": string;
663
+ /**
664
+ *The HTTP Integrity-Policy response header allows website administrators to ensure that all resources the user agent loads (of a certain type) have Subresource Integrity guarantees.
665
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Integrity-Policy
666
+ * */
667
+ "Integrity-Policy": string;
668
+ /**
669
+ * The HTTP Integrity-Policy-Report-Only response header allows website administrators to report on resources that the user agent loads that would violate Subresource Integrity guarantees if the integrity policy was enforced (using the Integrity-Policy header).
670
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Integrity-Policy-Report-Only
671
+ * */
672
+ "Integrity-Policy-Report-Only": string;
673
+ /**
674
+ *The HTTP Keep-Alive request and response header allows the sender to hint how a connection may be used in terms of a timeout and a maximum amount of requests.
675
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Keep-Alive
676
+ * */
677
+ "Keep-Alive": string;
678
+ /**
679
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Last-Modified
680
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Last-Modified
681
+ * */
682
+ "Last-Modified": string;
683
+ /**
684
+ * The HTTP Link header provides a means for serializing one or more links in HTTP headers.
685
+ *
686
+ * This allows the server to point a client to another resource containing metadata about the requested resource.
687
+ *
688
+ * This header has the same semantics as the HTML <link> element.
689
+ *
690
+ * One benefit of using the Link header is that the browser can start preconnecting or preloading resources before the HTML itself is fetched and processed.
691
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link
692
+ * */
693
+ Link: string;
694
+ /**
695
+ *The HTTP Location response header indicates the URL to redirect a page to. It only provides a meaning when served with a 3XX redirection response or a 201 Created status response.
696
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Location
697
+ * */
698
+ Location: string;
699
+ /**
700
+ *The HTTP Max-Forwards request header is used with the TRACE method to limit the number of nodes (usually proxies) that the request goes through.
701
+
702
+ Its value is an integer indicating the maximum amount of nodes it must visit.
703
+
704
+ At each node, the value is decremented and the TRACE request is forwarded to the next node until the destination is reached or the received value of Max-Forwards is zero.
705
+
706
+ The request is then sent back (excluding sensitive headers where appropriate) as the body of a 200 response.
707
+
708
+ This allows the client to see what is being received at the other end of the request chain (the Via header is of particular interest) for testing or diagnostic purposes.
709
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Max-Forwards
710
+ * */
711
+ "Max-Forwards": string;
712
+ /**
713
+ *The HTTP Origin request header indicates the origin (scheme, hostname, and port) that caused the request. For example, if a user agent needs to request resources included in a page, or fetched by scripts that it executes, then the origin of the page may be included in the request.
714
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Origin
715
+ * */
716
+ Origin: string;
717
+ /**
718
+ *@deprecated
719
+ The HTTP Pragma header is an implementation-specific header that may have various effects along the request-response chain.
720
+
721
+ This header serves for backwards compatibility with HTTP/1.0 caches that do not support the Cache-Control HTTP/1.1 header.
722
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Pragma
723
+ * */
724
+ Pragma: string;
725
+ /**
726
+ *The HTTP Prefer header allows clients to indicate preferences for specific server behaviors during request processing.
727
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Prefer
728
+ * */
729
+ Prefer: string;
730
+ /**
731
+ *The HTTP Preference-Applied header informs the client about which preferences from the Prefer request header were applied by the server.
732
+
733
+ The server indicates if a preference is applied to a response if it would otherwise be ambiguous for the client.
734
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Preference-Applied
735
+ * */
736
+ "Preference-Applied": string;
737
+ /**
738
+ *The HTTP Priority header indicates a client's preference for the priority order at which the response containing the requested resource should be sent, relative to other resource requests on the same connection.
739
+
740
+ If the header is not specified in the request, a default priority is assumed.
741
+
742
+ The server may also include this header in responses in order to indicate it has an interest in changing the prioritization preferences the client advertized.
743
+
744
+ In responses, this information can be used as an input to the prioritization process for caching servers and other servers that are forwarding the response.
745
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Priority
746
+ * */
747
+ Priority: string;
748
+ /**
749
+ *The HTTP Proxy-Authenticate response header defines the authentication method (or challenge) that should be used to gain access to a resource behind a proxy server.
750
+
751
+ It is sent in a 407 Proxy Authentication Required response so a client can identify itself to a proxy that requires authentication.
752
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Proxy-Authenticate
753
+ * */
754
+ "Proxy-Authenticate": string;
755
+ /**
756
+ *The HTTP Proxy-Authorization request header contains the credentials to authenticate a client with a proxy server, typically after the server has responded with a 407 Proxy Authentication Required status with the Proxy-Authenticate header.
757
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Proxy-Authorization
758
+ * */
759
+ "Proxy-Authorization": string;
760
+ /**
761
+ *The HTTP Range request header indicates the part of a resource that the server should return.
762
+
763
+ Several parts can be requested at the same time in one Range header, and the server may send back these ranges in a multipart document.
764
+
765
+ If the server sends back ranges, it uses the 206 Partial Content status code for the response. If the ranges are invalid, the server returns the 416 Range Not Satisfiable error.
766
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Range
767
+ * */
768
+ Range: string;
769
+ /**
770
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referer
771
+ * */
772
+ Referer: string;
773
+ /**
774
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Refresh
775
+ * */
776
+ Refresh: string;
777
+ /**
778
+ * @deprecated
779
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Report-To
780
+ * */
781
+ "Report-To": string;
782
+ /**
783
+ *@limitedAvailability
784
+ @see https://developer.mozilla.org/en-US/docs/Web
785
+ * */
786
+ "Reporting-Endpoints": string;
787
+ /**
788
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Repr-Digest
789
+ * */
790
+ "Repr-Digest": string;
791
+ /**
792
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Retry-After
793
+ * */
794
+ "Retry-After": string;
795
+ /**
796
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Dest
797
+ * */
798
+ "Sec-Fetch-Dest": string;
799
+ /**
800
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Mode
801
+ * */
802
+ "Sec-Fetch-Mode": string;
803
+
804
+ /**
805
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site
806
+ * */
807
+ "Sec-Fetch-Site": string;
808
+ /**
809
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-User
810
+ * */
811
+ "Sec-Fetch-User": string;
812
+ /**
813
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-WebSocket-Accept
814
+ * */
815
+ "Sec-WebSocket-Accept": string;
816
+ /**
817
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-WebSocket-Extensions
818
+ * */
819
+ "Sec-WebSocket-Extensions": string;
820
+ /**
821
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-WebSocket-Key
822
+ * */
823
+ "Sec-WebSocket-Key": string;
824
+ /**
825
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-WebSocket-Protocol
826
+ * */
827
+ "Sec-WebSocket-Protocol": string;
828
+ /**
829
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-WebSocket-Version
830
+ * */
831
+ "Sec-WebSocket-Version": string;
832
+ /**
833
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Server
834
+ * */
835
+ Server: string;
836
+ /**
837
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Server-Timing
838
+ * */
839
+ "Server-Timing": string;
840
+ /**
841
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Service-Worker
842
+ * */
843
+ "Service-Worker": string;
844
+ /**
845
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Service-Worker-Allowed
846
+ * */
847
+ "Service-Worker-Allowed": string;
848
+ /**
849
+ * @limitedAvailability
850
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Service-Worker-Navigation-Preload
851
+ * */
852
+ "Service-Worker-Navigation-Preload header": string;
853
+ /**
854
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie
855
+ * */
856
+ "Set-Cookie": string;
857
+ /**
858
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Login
859
+ * */
860
+ "Set-Login": string;
861
+ /**
862
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/SourceMap
863
+ * */
864
+ SourceMap: string;
865
+ /**
866
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Strict-Transport-Security
867
+ * */
868
+ "Strict-Transport-Security": string;
869
+ /**
870
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/TE
871
+ * */
872
+ TE: string;
873
+ /**
874
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Timing-Allow-Origin
875
+ **/
876
+ "Timing-Allow-Origin": string;
877
+ /**
878
+ *@deprecated
879
+ @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Tk
880
+ * */
881
+ Tk: string;
882
+ /**
883
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Trailer
884
+ * */
885
+ Trailer: string;
886
+ /**
887
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Transfer-Encoding
888
+ * */
889
+ "Transfer-Encoding": string;
890
+ /**
891
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Upgrade
892
+ * */
893
+ Upgrade: string;
894
+ /**
895
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Upgrade-Insecure-Requests
896
+ * */
897
+ "Upgrade-Insecure-Requests": string;
898
+ /**
899
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/User-Agent
900
+ * */
901
+ "User-Agent": string;
902
+ /**
903
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Vary
904
+ * */
905
+ Vary: string;
906
+ /**
907
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Via
908
+ * */
909
+ Via: string;
910
+ /**
911
+ *@deprecated
912
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Viewport-Width
913
+ * */
914
+ "Viewport-Width": string;
915
+ /**
916
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Want-Content-Digest
917
+ * */
918
+ "Want-Content-Digest": string;
919
+ /**
920
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Want-Repr-Digest
921
+ * */
922
+ "Want-Repr-Digest": string;
923
+ /**
924
+ * @deprecated
925
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Warning
926
+ * */
927
+ Warning: string;
928
+ /**
929
+ * @deprecated
930
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Width
931
+ * */
932
+ Width: string;
933
+ /**
934
+ *@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/WWW-Authenticate
935
+ * */
936
+ "WWW-Authenticate": string;
147
937
  };
148
938
  export type BaseHeaders = Partial<
149
- allHeaders & helmetHeadersT & { [key: string]: string }
939
+ simpleHeaders &
940
+ helmetHeadersT &
941
+ experimentalHeaders &
942
+ CORSHeader & { [key: string]: string }
150
943
  >;
151
944
  /**
152
945
  * A map containing all headers as ArrayBuffers, so speed remains. There are several use cases of it:
153
946
  * 1) Don't define them in requests ( post(res){new HeadersMap({...headers}).prepare().toRes(res)} ). This is slow. Define maps BEFORE actual usage.
154
947
  * 2) You can pass them in LightMethod or HeavyMethod in shared property (but handle it manually)
155
- * 3) As a default use HeadersMap.default. It can't be edited, because it is already "prepared".
156
- * 4) Don't define them before writing status on request. uWebSockets.js after first written header considers response successful and puts "200" code automatically. Set headers AFTER validation in class controllers (handler function) and after writing status (or don't write it at all. It will be 200).
948
+ * 3) Don't define them before writing status on request. uWebSockets.js after first written header considers response as successful and puts "200" code automatically. Set headers AFTER validation in class controllers (handler function) and after writing status (or don't write it at all. It will be 200).
157
949
  */
158
950
  export class HeadersMap<Opts extends BaseHeaders> extends Map {
159
951
  public currentHeaders: undefined | Opts;
@@ -282,4 +1074,6 @@ export var CSPDirs: {
282
1074
  */
283
1075
  "media-src": string[];
284
1076
  };
285
- export type lowHeaders = Lowercase<keyof allHeaders>;
1077
+ export type lowHeaders = Lowercase<
1078
+ keyof (simpleHeaders & helmetHeadersT & experimentalHeaders & CORSHeader)
1079
+ >;