@alwatr/http-primer 6.0.21 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/type.ts ADDED
@@ -0,0 +1,879 @@
1
+ import type {} from '@alwatr/type-helper';
2
+
3
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'CONNECT' | 'TRACE';
4
+
5
+ /**
6
+ * Represents the collection of HTTP response headers.
7
+ *
8
+ * For supporting custom headers, you can use intersection with a dictionary type, e.g., `HttpResponseHeaders & DictionaryReq<string>`.
9
+ */
10
+ export type HttpResponseHeaders = {
11
+ /**
12
+ * Indicates if the server supports range requests for the target resource.
13
+ */
14
+ 'accept-ranges'?: string;
15
+
16
+ /**
17
+ * Specifies the time in seconds the object has been in a proxy cache.
18
+ */
19
+ age?: string;
20
+
21
+ /**
22
+ * Lists the set of HTTP methods supported by the resource identified by the Request-URI.
23
+ */
24
+ allow?: string;
25
+
26
+ /**
27
+ * Specifies caching directives for both requests and responses.
28
+ */
29
+ 'cache-control'?: string;
30
+
31
+ /**
32
+ * Controls whether the network connection stays open after the current transaction.
33
+ */
34
+ connection?: string;
35
+
36
+ /**
37
+ * Suggests a filename for the downloaded resource or how the content should be displayed.
38
+ */
39
+ 'content-disposition'?: string;
40
+
41
+ /**
42
+ * Indicates what content encodings have been applied to the entity-body.
43
+ */
44
+ 'content-encoding'?: string;
45
+
46
+ /**
47
+ * Describes the natural language(s) of the intended audience for the enclosed entity.
48
+ */
49
+ 'content-language'?: string;
50
+
51
+ /**
52
+ * Indicates the size of the entity-body, in bytes, sent to the recipient.
53
+ */
54
+ 'content-length'?: string | number;
55
+
56
+ /**
57
+ * Indicates an alternate location for the returned data.
58
+ */
59
+ 'content-location'?: string;
60
+
61
+ /**
62
+ * Indicates where in a full body message a partial message belongs.
63
+ */
64
+ 'content-range'?: string;
65
+
66
+ /**
67
+ * Indicates the media type of the entity-body sent to the recipient.
68
+ */
69
+ 'content-type'?: string;
70
+
71
+ /**
72
+ * Indicates the date and time at which the message was originated.
73
+ */
74
+ date?: string;
75
+
76
+ /**
77
+ * Provides the current value of the entity tag for the requested variant.
78
+ */
79
+ etag?: string;
80
+
81
+ /**
82
+ * Gives the date/time after which the response is considered stale.
83
+ */
84
+ expires?: string;
85
+
86
+ /**
87
+ * Indicates the date and time at which the origin server believes the variant was last modified.
88
+ */
89
+ 'last-modified'?: string;
90
+
91
+ /**
92
+ * Provides a list of URIs associated with the resource.
93
+ */
94
+ link?: string;
95
+
96
+ /**
97
+ * Used in redirection, or when a new resource has been created.
98
+ */
99
+ location?: string;
100
+
101
+ /**
102
+ * Used for backward compatibility with HTTP/1.0 caches.
103
+ */
104
+ pragma?: string;
105
+
106
+ /**
107
+ * Requests authentication information from the client for a proxy server.
108
+ */
109
+ 'proxy-authenticate'?: string;
110
+
111
+ /**
112
+ * Indicates how long the user agent should wait before making a follow-up request.
113
+ */
114
+ 'retry-after'?: string;
115
+
116
+ /**
117
+ * Contains information about the software used by the origin server to handle the request.
118
+ */
119
+ server?: string;
120
+
121
+ /**
122
+ * Used to send cookies from the server to the user agent.
123
+ */
124
+ 'set-cookie'?: string[];
125
+
126
+ /**
127
+ * Tells browsers to access the server using HTTPS only.
128
+ */
129
+ 'strict-transport-security'?: string;
130
+
131
+ /**
132
+ * Allows the sender to include additional fields at the end of chunked messages.
133
+ */
134
+ trailer?: string;
135
+
136
+ /**
137
+ * Specifies the form of encoding used to safely transfer the entity to the user.
138
+ */
139
+ 'transfer-encoding'?: string;
140
+
141
+ /**
142
+ * Determines how to match future request headers to decide whether a cached response
143
+ * can be used rather than requesting a fresh one from the origin server.
144
+ */
145
+ vary?: string;
146
+
147
+ /**
148
+ * Lists all intermediate proxies the message has traversed
149
+ */
150
+ via?: string;
151
+
152
+ /**
153
+ * Contains additional information about the status or transformation of a message that might not be reflected in the status code.
154
+ */
155
+ warning?: string;
156
+
157
+ /**
158
+ * Indicates the authentication scheme that should be used to access the requested entity.
159
+ */
160
+ 'www-authenticate'?: string;
161
+ };
162
+
163
+ /**
164
+ * Represents the collection of all HTTP Request headers.
165
+ *
166
+ * For supporting custom headers, you can use intersection with a dictionary type, e.g., `HttpResponseHeaders & DictionaryReq<string>`.
167
+ */
168
+ export type HttpRequestHeaders = {
169
+ /**
170
+ * Content-Types that are acceptable for the response.
171
+ *
172
+ * Example: `accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*\/*;q=0.8'`
173
+ */
174
+ accept?: string;
175
+
176
+ /**
177
+ * Character sets that are acceptable.
178
+ *
179
+ * Example: `accept-charset: 'utf-8, iso-8859-1;q=0.5'`
180
+ */
181
+ 'accept-charset'?: string;
182
+
183
+ /**
184
+ * List of acceptable encodings.
185
+ *
186
+ * Example: `accept-encoding: 'gzip, deflate, br'`
187
+ */
188
+ 'accept-encoding'?: string;
189
+
190
+ /**
191
+ * List of acceptable languages for the response.
192
+ *
193
+ * Example: `accept-language: 'en-US,en;q=0.5'`
194
+ */
195
+ 'accept-language'?: string;
196
+
197
+ /**
198
+ * Authentication credentials for HTTP authentication.
199
+ *
200
+ * Example: `authorization: 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='`
201
+ */
202
+ authorization?: string;
203
+
204
+ /**
205
+ * Used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.
206
+ *
207
+ * Example: `cache-control: 'no-cache'`
208
+ */
209
+ 'cache-control'?: string;
210
+
211
+ /**
212
+ * The type of encoding used on the data.
213
+ *
214
+ * Example: `content-encoding: 'gzip'`
215
+ */
216
+ 'content-encoding'?: string;
217
+
218
+ /**
219
+ * The natural language or languages of the intended audience for the enclosed content.
220
+ *
221
+ * Example: `content-language: 'en-US'`
222
+ */
223
+ 'content-language'?: string;
224
+
225
+ /**
226
+ * The length of the request body in octets (8-bit bytes).
227
+ *
228
+ * Example: `content-length: '1234'`
229
+ */
230
+ 'content-length'?: string;
231
+
232
+ /**
233
+ * An alternate location for the returned data (like a redirect).
234
+ *
235
+ * Example: `content-location: '/index.html'`
236
+ */
237
+ 'content-location'?: string;
238
+
239
+ /**
240
+ * A Base64-encoded binary MD5 sum of the content of the request body.
241
+ *
242
+ * Example: `content-md5: 'Q2hlY2sgSW50ZWdyaXR5IQ=='`
243
+ */
244
+ 'content-md5'?: string;
245
+
246
+ /**
247
+ * The MIME type of the body of the request (used with POST and PUT requests).
248
+ *
249
+ * Example: `content-type: 'application/x-www-form-urlencoded'`
250
+ */
251
+ 'content-type'?: string;
252
+
253
+ /**
254
+ * An HTTP cookie previously sent by the server with `Set-Cookie`.
255
+ *
256
+ * Example: `cookie: 'sessionid=38afes7a8'`
257
+ */
258
+ cookie?: string;
259
+
260
+ /**
261
+ * The date and time that the message was originated (in "HTTP-date" format as defined by RFC 7231).
262
+ *
263
+ * Example: `date: 'Sun, 06 Nov 1994 08:49:37 GMT'`
264
+ */
265
+ date?: string;
266
+
267
+ /**
268
+ * The email address of the user making the request.
269
+ *
270
+ * Example: `from: 'user@example.com'`
271
+ */
272
+ from?: string;
273
+
274
+ /**
275
+ * The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening.
276
+ * The port number may be omitted if the port is the standard port for the service requested.
277
+ *
278
+ * Example: `host: 'en.wikipedia.org:8080'`
279
+ */
280
+ host?: string;
281
+
282
+ /**
283
+ * Only send the response if the entity has not been modified since a specific time.
284
+ *
285
+ * Example: `if-modified-since: 'Sat, 29 Oct 1994 19:43:31 GMT'`
286
+ */
287
+ 'if-modified-since'?: string;
288
+
289
+ /**
290
+ * Allows a 304 Not Modified to be returned if content is unchanged.
291
+ *
292
+ * Example: `if-none-match: '"737060cd8c284d8af7ad3082f209582d"'`
293
+ */
294
+ 'if-none-match'?: string;
295
+
296
+ /**
297
+ * If the entity is unchanged, send me the part(s) that I am missing; otherwise, send me the entire new entity.
298
+ *
299
+ * Example: `if-range: '"737060cd8c284d8af7ad3082f209582d"'`
300
+ */
301
+ 'if-range'?: string;
302
+
303
+ /**
304
+ * Only send the response if the entity has been modified since a specific time.
305
+ *
306
+ * Example: `if-unmodified-since: 'Sat, 29 Oct 1994 19:43:31 GMT'`
307
+ */
308
+ 'if-unmodified-since'?: string;
309
+
310
+ /**
311
+ * Limit the number of times the message can be forwarded through proxies or gateways.
312
+ *
313
+ * Example: `max-forwards: '10'`
314
+ */
315
+ 'max-forwards'?: string;
316
+
317
+ /**
318
+ * Implementation-specific headers that may have various effects anywhere along the request-response chain.
319
+ *
320
+ * Example: `pragma: 'no-cache'`
321
+ */
322
+ pragma?: string;
323
+
324
+ /**
325
+ * Authorization credentials for connecting to a proxy.
326
+ *
327
+ * Example: `proxy-authorization: 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='`
328
+ */
329
+ 'proxy-authorization'?: string;
330
+
331
+ /**
332
+ * Request only part of an entity. Bytes are numbered from 0.
333
+ *
334
+ * Example: `range: 'bytes=500-999'`
335
+ */
336
+ range?: string;
337
+
338
+ /**
339
+ * This is the address of the previous web page from which a link to the currently requested page was followed.
340
+ * (The word "referrer" is misspelled in the RFC as well as in most implementations.)
341
+ *
342
+ * Example: `referer: 'https://en.wikipedia.org/wiki/Main_Page'`
343
+ */
344
+ referer?: string;
345
+
346
+ /**
347
+ * The user agent string of the user agent.
348
+ *
349
+ * Example: `user-agent: 'Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/21.0'`
350
+ */
351
+ 'user-agent'?: string;
352
+
353
+ /**
354
+ * Ask the server to upgrade to another protocol.
355
+ *
356
+ * Example: `upgrade: 'h2c, HTTPS/1.3, IRC/6.9, RTA/x11, websocket'`
357
+ */
358
+ upgrade?: string;
359
+
360
+ /**
361
+ * Informs the server of proxies through which the request was sent.
362
+ *
363
+ * Example: `via: '1.0 fred, 1.1 example.com (Apache/1.1)'`
364
+ */
365
+ via?: string;
366
+
367
+ /**
368
+ * A general warning about possible problems with the entity body.
369
+ *
370
+ * Example: `warning: '199 Miscellaneous warning'`
371
+ */
372
+ warning?: string;
373
+
374
+ /**
375
+ * Tells all caching mechanisms from server to client whether they may cache this object.
376
+ * It is similar to Cache-Control: no-cache, but only applies to proxies and does not apply to private caches.
377
+ *
378
+ * Example: `age: '12'`
379
+ */
380
+ age?: string;
381
+
382
+ /**
383
+ * Appends " trailers " to the list of acceptable transfer encodings in the `TE` header.
384
+ *
385
+ * Example: `allow: 'GET, HEAD'`
386
+ */
387
+ allow?: string;
388
+
389
+ /**
390
+ * What partial content range types this server supports via the `Range` header.
391
+ *
392
+ * Example: `a-im: 'feed'`
393
+ */
394
+ 'a-im'?: string;
395
+
396
+ /**
397
+ * Alternative addresses (e-mail) to reply to for user agents that support multiple reply addresses
398
+ * in the `From` header field
399
+ *
400
+ * Example: `alt-svc: 'h3-29=":443"; ma=86400, h3-T051=":443"; ma=86400, h3-Q050=":443"; ma=86400,
401
+ * h3-Q046=":443"; ma=86400, h3-Q043=":443"; ma=86400, quic=":443"; ma=86400; v="43,46"'`
402
+ */
403
+ 'alt-used'?: string;
404
+
405
+ /**
406
+ * Authentication credentials for HTTP authentication
407
+ *
408
+ * Example: `apply-to-redirect-ref: 'false'`
409
+ */
410
+ 'apply-to-redirect-ref'?: string;
411
+
412
+ /**
413
+ * Used in redirection, or when a new resource has been created. This refresh redirects after 5 seconds.
414
+ * This is a proprietary, non-standard header extension introduced by Netscape and supported by most web browsers.
415
+ *
416
+ * Example: `authentication-control: 'max-age=3600'`
417
+ */
418
+ 'authentication-info'?: string;
419
+
420
+ /**
421
+ * An HTTP cookie previously sent by the server with `Set-Cookie` (sent when connecting to a proxy)
422
+ *
423
+ * Example: `connection: 'keep-alive'`
424
+ */
425
+ connection?: string;
426
+
427
+ /**
428
+ * The MIME type of the body of the request (used with POST and PUT requests)
429
+ *
430
+ * Example: `content-range: 'bytes 200-1000/67589'`
431
+ */
432
+ 'content-range'?: string;
433
+
434
+ /**
435
+ * The date and time that the message was sent (in "HTTP-date" format as defined by RFC 7231)
436
+ *
437
+ * Example: `content-security-policy: 'default-src 'self'; img-src *'`
438
+ */
439
+ 'content-security-policy'?: string;
440
+
441
+ /**
442
+ * Control options for the current connection and list of hop-by-hop response fields.
443
+ *
444
+ * Example: `content-security-policy-report-only: 'default-src 'self'; report-uri /csp-violation-report-endpoint/'`
445
+ */
446
+ 'content-security-policy-report-only'?: string;
447
+
448
+ /**
449
+ * An identifier for a specific dialog in the browser (for cross-document communication), such as prompting the user
450
+ * for a username and password
451
+ *
452
+ * Example: `cross-origin-embedder-policy: 'require-corp'`
453
+ */
454
+ 'cross-origin-embedder-policy'?: string;
455
+
456
+ /**
457
+ * An optional token returned by an origin in response to a preflight request
458
+ * that includes the `Access-Control-Request-Headers` to indicate that the actual request can include
459
+ * those headers.
460
+ *
461
+ * Example: `cross-origin-opener-policy: 'same-origin'`
462
+ */
463
+ 'cross-origin-opener-policy'?: string;
464
+
465
+ /**
466
+ * The destination of a message (e-mail)
467
+ *
468
+ * Example: `cross-origin-resource-policy: 'cross-origin'`
469
+ */
470
+ 'cross-origin-resource-policy'?: string;
471
+
472
+ /**
473
+ * Requests HTTP Public Key Pinning (HPKP) to associate a specific cryptographic public key with a certain web server
474
+ * to decrease the risk of MITM attacks with forged certificates. Deprecated and removed from Browsers
475
+ *
476
+ * Example: `device-memory: '0.25'`
477
+ */
478
+ 'device-memory'?: string;
479
+
480
+ /**
481
+ * Used to identify the protocol at the application layer of the OSI model
482
+ *
483
+ * Example: `dnt: '1'`
484
+ */
485
+ dnt?: string;
486
+
487
+ /**
488
+ * The `Expect` HTTP header indicates expectations that need to be fulfilled by the server in order to properly
489
+ * handle the request.
490
+ *
491
+ * Example: `downlink: '10'`
492
+ */
493
+ downlink?: string;
494
+
495
+ /**
496
+ * Specifies the effective connection type the user agent has to the network.
497
+ *
498
+ * Example: `ect: '4g'`
499
+ */
500
+ ect?: string;
501
+
502
+ /**
503
+ * The `Early-Data` header indicates a request that includes an Early Data body
504
+ *
505
+ * Example: `early-data: '1'`
506
+ */
507
+ 'early-data'?: string;
508
+
509
+ /**
510
+ * The `Expect-CT` header is used by a server to indicate that browsers should evaluate connections to the host
511
+ * for Certificate Transparency compliance and report failures to the specified URI. Deprecated and removed from browsers.
512
+ *
513
+ * Example: `expect: '100-continue'`
514
+ */
515
+ 'expect-ct'?: string;
516
+
517
+ /**
518
+ * Additional information about the client or user agent, typically for statistical purposes
519
+ * or for determining the capabilities of the client software
520
+ *
521
+ * Example: `expect-ct: 'max-age=86400, report-uri="https://report-uri.example.com/report"'`
522
+ */
523
+ forwarded?: string;
524
+
525
+ /**
526
+ * The `Keep-Alive` general header allows the sender to hint about how the connection may be used to
527
+ * set a timeout and a maximum amount of requests.
528
+ *
529
+ * Example: `keep-alive: 'timeout=5, max=1000'`
530
+ */
531
+ 'keep-alive'?: string;
532
+
533
+ /**
534
+ * Specifies the preferred maximum estimated round trip time (rtt) of the connection
535
+ *
536
+ * Example: `large-allocation: '1'`
537
+ */
538
+ 'large-allocation'?: string;
539
+
540
+ /**
541
+ * The `Last-Event-ID` header identifies the last event ID processed by the client.
542
+ *
543
+ * Example: `last-event-id: '123'`
544
+ */
545
+ 'last-event-id'?: string;
546
+
547
+ /**
548
+ * An arbitrary, opaque byte sequence used for linking multiple requests together
549
+ *
550
+ * Example: `link: '</feed.xml>; rel="alternate"'`
551
+ */
552
+ link?: string;
553
+
554
+ /**
555
+ * Used with the Location response header to indicate the identifier of the payload body sent in the request
556
+ *
557
+ * Example: `location: '/new/document'`
558
+ */
559
+ origin?: string;
560
+
561
+ /**
562
+ * The `Ping-From` header specifies a URI where a pong response may be sent.
563
+ *
564
+ * Example: `ping-from: 'https://example.com/pong'`
565
+ */
566
+ 'ping-from'?: string;
567
+
568
+ /**
569
+ * The `Ping-To` header specifies a URI that will accept a pong response.
570
+ *
571
+ * Example: `ping-to: 'https://example.com/pong'`
572
+ */
573
+ 'ping-to'?: string;
574
+
575
+ // ... (Previous headers from the previous response) ...
576
+
577
+ /**
578
+ * Initiates an HTTP 2 Server Push. This is a request for the server to push the given resources to the client in
579
+ * anticipation of their use.
580
+ *
581
+ * Example: `push-policy: 'push_critical_resources_first'`
582
+ */
583
+ 'push-policy'?: string;
584
+
585
+ /**
586
+ * The `Purpose` header is used to indicate the purpose of the present request
587
+ * (such as prefetch, prerender, or an actual browse).
588
+ *
589
+ * Example: `purpose: 'prefetch'`
590
+ */
591
+ purpose?: string;
592
+
593
+ /**
594
+ * Used to indicate the part of a document to return.
595
+ *
596
+ * Example: `referrer-policy: 'no-referrer'`
597
+ */
598
+ 'referrer-policy'?: string;
599
+
600
+ /**
601
+ * The `Retry-After` response HTTP header indicates how long the user agent should wait
602
+ * before making a follow-up request.
603
+ *
604
+ * Example: `retry-after: '3600'`
605
+ */
606
+ 'retry-after'?: string;
607
+
608
+ /**
609
+ * The `Save-Data` client hint request header indicates the user's preference for reduced data usage.
610
+ *
611
+ * Example: `save-data: 'on'`
612
+ */
613
+ 'save-data'?: string;
614
+
615
+ /**
616
+ * The `Sec-Fetch-Dest` header indicates the request's destination. It can be one of the following values:
617
+ * - audio: An audio file.
618
+ * - audioworklet: An audio worklet.
619
+ * - document: A document.
620
+ * - embed: An embedded resource.
621
+ * - empty: An empty response (e.g., in response to a HEAD request).
622
+ * - font: A font file.
623
+ * - frame: An iframe.
624
+ * - image: An image file.
625
+ * - manifest: A manifest file.
626
+ * - object: An object or an EMBED element.
627
+ * - paintworklet: A paint worklet.
628
+ * - report: A report.
629
+ * - script: A script.
630
+ * - serviceworker: A service worker.
631
+ * - sharedworker: A shared worker.
632
+ * - style: A stylesheet.
633
+ * - track: A track file.
634
+ * - video: A video file.
635
+ * - worker: A dedicated worker.
636
+ * - xslt: An XSLT stylesheet.
637
+ *
638
+ * Example: `sec-fetch-dest: 'image'`
639
+ */
640
+ 'sec-fetch-dest'?: string;
641
+
642
+ /**
643
+ * The `Sec-Fetch-Mode` header indicates how the resource was fetched.
644
+ * It can be one of the following values:
645
+ * - cors: A cross-origin request using the CORS protocol.
646
+ * - navigate: A navigation request.
647
+ * - nested-navigate: A nested navigation request.
648
+ * - no-cors: A simple cross-origin request that does not use CORS.
649
+ * - same-origin: A same-origin request.
650
+ * - websocket: A WebSocket request.
651
+ *
652
+ * Example: `sec-fetch-mode: 'cors'`
653
+ */
654
+ 'sec-fetch-mode'?: string;
655
+
656
+ /**
657
+ * The `Sec-Fetch-Site` header indicates the relationship between the site
658
+ * making the request and the site hosting the resource.
659
+ * It can be one of the following values:
660
+ * - cross-site: The request is made to a different site than the one the request
661
+ * originated from, including when the first-party and third-party sites have the same owner.
662
+ * - same-origin: The request is made to the same site (the same scheme, host, and port).
663
+ * - same-site: The request is made to a different site, but both sites share the same
664
+ * registered domain name (eTLD+1).
665
+ * - none: The request is made to a data URL or Blob URL.
666
+ *
667
+ * Example: `sec-fetch-site: 'cross-site'`
668
+ */
669
+ 'sec-fetch-site'?: string;
670
+
671
+ /**
672
+ * The `Sec-Fetch-User` header indicates whether the resource request was initiated by a user gesture or not.
673
+ * It can be one of the following values:
674
+ * - ?1: The request was initiated by a user gesture.
675
+ * - ?0: The request was not initiated by a user gesture.
676
+ *
677
+ * Example: `sec-fetch-user: '?1'`
678
+ */
679
+ 'sec-fetch-user'?: string;
680
+
681
+ /**
682
+ * The `Sec-GPC` HTTP header is a signal that the user prefers a Global Privacy Control setting
683
+ * of 1, meaning "Do Not Sell or Share My Personal Information."
684
+ *
685
+ * Example: `sec-gpc: '1'`
686
+ */
687
+ 'sec-gpc'?: string;
688
+
689
+ /**
690
+ * The `Sec-WebSocket-Accept` header field is used in the WebSocket opening handshake.
691
+ * It is sent from the server to the client to confirm that the server is willing to initiate a WebSocket connection.
692
+ *
693
+ * Example: `sec-websocket-accept: 's3pPLMBiTxaQ9kYGzzhZRbK+xOo='`
694
+ */
695
+ 'sec-websocket-accept'?: string;
696
+
697
+ // ... (Previous headers from the previous response) ...
698
+
699
+ /**
700
+ * The `Sec-WebSocket-Extensions` header field is used in the WebSocket opening handshake.
701
+ * It is sent from the client to the server to indicate which extensions it would like to use,
702
+ * and from the server to the client to indicate which extensions the server is willing to use.
703
+ *
704
+ * Example: `sec-websocket-extensions: 'permessage-deflate; client_max_window_bits'`
705
+ */
706
+ 'sec-websocket-extensions'?: string;
707
+
708
+ /**
709
+ * The `Sec-WebSocket-Key` header field is used in the WebSocket opening handshake.
710
+ * It is sent from the client to the server to provide a random value that the server
711
+ * will use to generate the `Sec-WebSocket-Accept` header field.
712
+ *
713
+ * Example: `sec-websocket-key: 'dGhlIHNhbXBsZSBub25jZQ=='`
714
+ */
715
+ 'sec-websocket-key'?: string;
716
+
717
+ /**
718
+ * The `Sec-WebSocket-Protocol` header field is used in the WebSocket opening handshake.
719
+ * It is sent from the client to the server to indicate which subprotocols it would like to use,
720
+ * and from the server to the client to indicate which subprotocol the server has selected.
721
+ *
722
+ * Example: `sec-websocket-protocol: 'chat, superchat'`
723
+ */
724
+ 'sec-websocket-protocol'?: string;
725
+
726
+ /**
727
+ * The `Sec-WebSocket-Version` header field is used in the WebSocket opening handshake.
728
+ * It is sent from the client to the server to indicate which version of the WebSocket protocol it is using.
729
+ *
730
+ * Example: `sec-websocket-version: '13'`
731
+ */
732
+ 'sec-websocket-version'?: string;
733
+
734
+ /**
735
+ * The `Server` header field contains information about the software used by the origin server
736
+ * to handle the request.
737
+ *
738
+ * Example: `server: 'Apache/2.4.1 (Unix)'`
739
+ */
740
+ server?: string;
741
+
742
+ /**
743
+ * The `Service-Worker-Navigation-Preload` header is used to control the behavior of
744
+ * service worker navigation preloads.
745
+ *
746
+ * Example: `service-worker-navigation-preload: 'true'`
747
+ */
748
+ 'service-worker-navigation-preload'?: string;
749
+
750
+ /**
751
+ * The `SourceMap` or `X-SourceMap` HTTP header links a generated code file (such as a JavaScript or CSS file)
752
+ * to an original source code file, enabling developers to debug the generated code
753
+ * in the context of the original source code.
754
+ *
755
+ * Example: `sourcemap: '/path/to/file.js.map'`
756
+ */
757
+ sourcemap?: string;
758
+
759
+ /**
760
+ * The `Strict-Transport-Security` (HSTS) response header informs browsers that a website
761
+ * should only be accessed using HTTPS, and that any future attempts to access it using HTTP should automatically
762
+ * be converted to HTTPS.
763
+ *
764
+ * Example: `strict-transport-security: 'max-age=31536000; includeSubDomains'`
765
+ */
766
+ 'strict-transport-security'?: string;
767
+
768
+ /**
769
+ * The `TE` header specifies the transfer encodings that the user agent is willing to accept
770
+ * in the response and indicates a preference for chunked transfer encoding if the server supports it.
771
+ *
772
+ * Example: `te: 'trailers, deflate'`
773
+ */
774
+ te?: string;
775
+
776
+ /**
777
+ * The `Timing-Allow-Origin` response header specifies origins that are allowed to see values of attributes
778
+ * retrieved via features of the Resource Timing API, which would otherwise be reported as zero due to cross-origin restrictions.
779
+ *
780
+ * Example: `timing-allow-origin: 'https://www.example.com'`
781
+ */
782
+ 'timing-allow-origin'?: string;
783
+
784
+ /**
785
+ * The `Trailer` general header indicates that the given set of header fields
786
+ * will be present in the trailer of a message encoded with chunked transfer encoding.
787
+ *
788
+ * Example: `trailer: 'Expires'`
789
+ */
790
+ trailer?: string;
791
+
792
+ /**
793
+ * The `Transfer-Encoding` header field lists the transfer encodings applied to the message body
794
+ * in order to ensure safe and proper transfer of the message.
795
+ *
796
+ * Example: `transfer-encoding: 'chunked'`
797
+ */
798
+ 'transfer-encoding'?: string;
799
+
800
+ /**
801
+ * The `Upgrade-Insecure-Requests` header sends a signal to the server expressing the client’s preference
802
+ * for an encrypted and authenticated response, and that it can successfully handle the upgrade-insecure-requests CSP directive.
803
+ *
804
+ * Example: `upgrade-insecure-requests: '1'`
805
+ */
806
+ 'upgrade-insecure-requests'?: string;
807
+
808
+ /**
809
+ * The `Want-Digest` header field specifies one or more digest algorithms that the client would like to
810
+ * receive applied to the message body of a response.
811
+ *
812
+ * Example: `want-digest: 'SHA-256'`
813
+ */
814
+ 'want-digest'?: string;
815
+
816
+ /**
817
+ * The `X-Content-Type-Options` response HTTP header indicates whether or not the browser should sniff (determine)
818
+ * the MIME type of a file.
819
+ *
820
+ * Example: `x-content-type-options: 'nosniff'`
821
+ */
822
+ 'x-content-type-options'?: string;
823
+
824
+ /**
825
+ * The `X-DNS-Prefetch-Control` HTTP header controls DNS prefetching, a feature by which browsers proactively
826
+ * perform domain name resolution on both links that the user may choose to follow as well as URLs for items referenced
827
+ * by the document, including images, scripts, and style sheets.
828
+ *
829
+ * Example: `x-dns-prefetch-control: 'off'`
830
+ */
831
+ 'x-dns-prefetch-control'?: string;
832
+
833
+ /**
834
+ * The `X-Forwarded-For` (XFF) header is a de-facto standard header for identifying the originating IP address
835
+ * of a client connecting to a web server through an HTTP proxy or a load balancer.
836
+ *
837
+ * Example: `x-forwarded-for: 'client1, proxy1, proxy2'`
838
+ */
839
+ 'x-forwarded-for'?: string;
840
+
841
+ /**
842
+ * The `X-Forwarded-Host` (XFH) header is a de-facto standard header for identifying the original host requested by the client
843
+ * in the Host HTTP request header, since the Host header is usually overwritten by proxies.
844
+ *
845
+ * Example: `x-forwarded-host: 'en.wikipedia.org'`
846
+ */
847
+ 'x-forwarded-host'?: string;
848
+
849
+ /**
850
+ * The `X-Forwarded-Proto` (XFP) header is a de-facto standard header for identifying the protocol (HTTP or HTTPS) that a client
851
+ * used to connect to your proxy or load balancer.
852
+ *
853
+ * Example: `x-forwarded-proto: 'https'`
854
+ */
855
+ 'x-forwarded-proto'?: string;
856
+
857
+ /**
858
+ * The `X-Frame-Options` HTTP response header can be used to indicate whether or not a browser should be allowed
859
+ * to render a page in a `<frame>`, `<iframe>`, `<embed>` or `<object>`.
860
+ *
861
+ * Example: `x-frame-options: 'SAMEORIGIN'`
862
+ */
863
+ 'x-frame-options'?: string;
864
+
865
+ /**
866
+ * The `X-Requested-With` header is commonly used to identify Ajax requests.
867
+ * Most JavaScript frameworks send this header with requests.
868
+ *
869
+ * Example: `x-requested-with: 'XMLHttpRequest'`
870
+ */
871
+ 'x-requested-with'?: string;
872
+
873
+ /**
874
+ * The `X-XSS-Protection` HTTP header is a basic protection against cross-site scripting (XSS) attacks for older browsers.
875
+ *
876
+ * Example: `x-xss-protection: '1; mode=block'`
877
+ */
878
+ 'x-xss-protection'?: string;
879
+ };