@unshared/client 0.6.5 → 0.7.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.
Files changed (52) hide show
  1. package/dist/HttpHeaders.cjs +1 -1
  2. package/dist/HttpHeaders.cjs.map +1 -1
  3. package/dist/HttpHeaders.d.ts +10145 -1117
  4. package/dist/HttpHeaders.js +1 -1
  5. package/dist/HttpHeaders.js.map +1 -1
  6. package/dist/HttpMethods.cjs.map +1 -1
  7. package/dist/HttpMethods.d.ts +506 -20
  8. package/dist/HttpMethods.js.map +1 -1
  9. package/dist/HttpStatusCodes.cjs.map +1 -1
  10. package/dist/HttpStatusCodes.d.ts +2539 -83
  11. package/dist/HttpStatusCodes.js.map +1 -1
  12. package/dist/chunks/{CThSMMCZ.cjs → -InYnohy.cjs} +41 -50
  13. package/dist/chunks/{CThSMMCZ.cjs.map → -InYnohy.cjs.map} +1 -1
  14. package/dist/chunks/B6pUErTM.js.map +1 -1
  15. package/dist/chunks/BDxlAULu.cjs.map +1 -1
  16. package/dist/chunks/B_Gz6Yz8.js.map +1 -1
  17. package/dist/chunks/C83nLcQu.js.map +1 -1
  18. package/dist/chunks/{CQUndCW0.cjs → CNNxr5Ws.cjs} +8 -4
  19. package/dist/chunks/CNNxr5Ws.cjs.map +1 -0
  20. package/dist/chunks/{BGG3bT7O.d.ts → CNqEW-S3.d.ts} +12 -8
  21. package/dist/chunks/ClHrsaTt.js +19 -0
  22. package/dist/chunks/ClHrsaTt.js.map +1 -0
  23. package/dist/chunks/DEyigyGy.cjs.map +1 -1
  24. package/dist/chunks/DJyo3R5b.cjs.map +1 -1
  25. package/dist/chunks/{DAtM4FUl.d.ts → DKPTfBgy.d.ts} +1 -1
  26. package/dist/chunks/{uqfvs89o.js → DZ2MwV7J.js} +41 -50
  27. package/dist/chunks/{uqfvs89o.js.map → DZ2MwV7J.js.map} +1 -1
  28. package/dist/createClient.cjs +2 -2
  29. package/dist/createClient.cjs.map +1 -1
  30. package/dist/createClient.d.ts +3 -2
  31. package/dist/createClient.js +2 -2
  32. package/dist/createClient.js.map +1 -1
  33. package/dist/createService.cjs +1 -1
  34. package/dist/createService.cjs.map +1 -1
  35. package/dist/createService.d.ts +3 -2
  36. package/dist/createService.js +1 -1
  37. package/dist/createService.js.map +1 -1
  38. package/dist/index.cjs +2 -2
  39. package/dist/index.d.ts +3 -2
  40. package/dist/index.js +2 -2
  41. package/dist/openapi.cjs.map +1 -1
  42. package/dist/openapi.d.ts +20 -2
  43. package/dist/openapi.js.map +1 -1
  44. package/dist/utils.cjs +1 -1
  45. package/dist/utils.cjs.map +1 -1
  46. package/dist/utils.d.ts +5 -5
  47. package/dist/utils.js +3 -3
  48. package/dist/utils.js.map +1 -1
  49. package/package.json +4 -4
  50. package/dist/chunks/CQUndCW0.cjs.map +0 -1
  51. package/dist/chunks/xJaQKKe2.js +0 -15
  52. package/dist/chunks/xJaQKKe2.js.map +0 -1
@@ -1,36 +1,133 @@
1
1
  declare enum HttpStatusCode {
2
2
  /**
3
- * The HTTP **`100 Continue`** [informational response](/en-US/docs/Web/HTTP/Status#informational_responses) status code indicates that the initial part of a request has been received and has not yet been rejected by the server.
3
+ * The HTTP **`100 Continue`** [informational response](/en-US/docs/Web/HTTP/Reference/Status#informational_responses) status code indicates that the initial part of a request has been received and has not yet been rejected by the server.
4
4
  * The client should continue with a request or discard the 100 response if the request is already finished.
5
5
  *
6
6
  * When a request has an [Expect: 100-continue](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect) header, the 100 Continue response indicates that the server is ready or capable of receiving the request content.
7
7
  * Waiting for a 100 Continue 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.
8
+ *
9
+ * ## Status
10
+ *
11
+ * ```http
12
+ * 100 Continue
13
+ * ```
14
+ *
15
+ * ## Examples
16
+ *
17
+ * ### PUT request with 100 Continue
18
+ *
19
+ * The following [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/PUT) request sends information to a server about a file upload.
20
+ * The client is indicating that it will proceed with the content if it receives a 100 response to avoid sending data over the network that could result in an error like [405](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405), [401](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401), or [403](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403).
21
+ * At first, the client sends headers only, including an [Expect: 100-continue](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect) header:
22
+ *
23
+ * ```http
24
+ * PUT /videos HTTP/1.1
25
+ * Host: uploads.example.com
26
+ * Content-Type: video/h264
27
+ * Content-Length: 123456789
28
+ * Expect: 100-continue
29
+ * ```
30
+ *
31
+ * The server indicates that the request can proceed:
32
+ *
33
+ * ```http
34
+ * HTTP/1.1 100 Continue
35
+ * ```
36
+ *
37
+ * The client completes the request by sending the actual data:
38
+ *
39
+ * ```http
40
+ * [Video data as content for PUT request]
41
+ * ```
42
+ *
43
+ * ## Specifications
44
+ *
45
+ * ## See also
46
+ *
47
+ * - [Expect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect)
48
+ * -
8
49
  */
9
50
  CONTINUE = 100,
10
51
  /**
11
- * The HTTP **`101 Switching Protocols`** [informational response](/en-US/docs/Web/HTTP/Status#informational_responses) status code indicates the protocol that a server has switched to.
52
+ * The HTTP **`101 Switching Protocols`** [informational response](/en-US/docs/Web/HTTP/Reference/Status#informational_responses) status code indicates the protocol that a server has switched to.
12
53
  * The protocol is specified in the [Upgrade](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade) request header received from a client.
13
54
  *
14
55
  * The server includes an [Upgrade](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade) header in this response to indicate the protocol it has agreed to switch to.
15
- * The process is described in detail in the [Protocol upgrade mechanism](/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism) guide.
56
+ * The process is described in detail in the [Protocol upgrade mechanism](/en-US/docs/Web/HTTP/Guides/Protocol_upgrade_mechanism) guide.
57
+ *
58
+ * ## Status
59
+ *
60
+ * ```http
61
+ * 101 Switching Protocols
62
+ * ```
63
+ *
64
+ * ## Examples
65
+ *
66
+ * ### Switching protocols to WebSockets
67
+ *
68
+ * The following example shows how switching protocols might be used with [WebSockets](/en-US/docs/Web/API/WebSockets_API).
69
+ * A client sends a [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) HTTP request with an [Upgrade](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade) header which must also be listed in the [Connection](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header.
70
+ * The server agrees to switch protocols, returning a 101 response meaning the connection has switched from HTTP to WebSocket.
71
+ * At this point, the client and server can now start exchanging WebSocket data.
72
+ * Information about how to set `Sec-WebSocket-*` headers for handshake negotiation can be found in [WebSocket-specific headers](/en-US/docs/Web/HTTP/Guides/Protocol_upgrade_mechanism#websocket-specific_headers).
73
+ *
74
+ * ```http
75
+ * GET /notifications HTTP/1.1
76
+ * Host: example.com
77
+ * Upgrade: websocket
78
+ * Connection: Upgrade
79
+ * ```
80
+ *
81
+ * ```http
82
+ * HTTP/1.1 101 Switching Protocols
83
+ * Upgrade: websocket
84
+ * Connection: Upgrade
85
+ * ```
86
+ *
87
+ * ## Specifications
88
+ *
89
+ * ## See also
90
+ *
91
+ * - [Protocol upgrade mechanism](/en-US/docs/Web/HTTP/Guides/Protocol_upgrade_mechanism)
92
+ * - [WebSockets](/en-US/docs/Web/API/WebSockets_API)
93
+ * - [Upgrade](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade)
94
+ * - [426 Upgrade Required](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/426)
16
95
  */
17
96
  SWITCHING_PROTOCOLS = 101,
18
97
  /**
19
- * The HTTP **`102 Processing`** [informational response](/en-US/docs/Web/HTTP/Status#informational_responses) status code indicates to client that a full request has been received and the server is working on it.
98
+ * The HTTP **`102 Processing`** [informational response](/en-US/docs/Web/HTTP/Reference/Status#informational_responses) status code indicates to client that a full request has been received and the server is working on it.
20
99
  * This status code is only sent if the server expects the request to take significant time.
21
100
  *
22
101
  * > [!NOTE]
23
102
  * > Regular web servers do not return this response.
24
103
  * > This status code was first introduced in Web Distributed Authoring and Versioning ([WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV)) [2518](https://developer.mozilla.org/en-US/docs/RFC/2518), but it was removed from WebDAV in [4918](https://developer.mozilla.org/en-US/docs/RFC/4918).
104
+ *
105
+ * ## Status
106
+ *
107
+ * ```http
108
+ * 102 Processing
109
+ * ```
110
+ *
111
+ * ## Specifications
112
+ *
113
+ * ## Browser compatibility
114
+ *
115
+ * This feature is deprecated and browsers will ignore this response status code.
116
+ *
117
+ * ## See also
118
+ *
119
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
120
+ * - [100](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100)
121
+ * - [rfc4918 '102 Processing' removal notes](https://www.rfc-editor.org/rfc/rfc4918#section-21.4)
25
122
  */
26
123
  PROCESSING = 102,
27
124
  /**
28
- * The HTTP **`103 Early Hints`** [informational response](/en-US/docs/Web/HTTP/Status#informational_responses) may be sent by a server while it is still preparing a response, with hints about the sites and resources that the server expects the final response will link to.
29
- * This allows a browser to [preconnect](/en-US/docs/Web/HTML/Attributes/rel/preconnect) to sites or start [preloading](/en-US/docs/Web/HTML/Attributes/rel/preload) resources even before the server has prepared and sent a final response.
125
+ * The HTTP **`103 Early Hints`** [informational response](/en-US/docs/Web/HTTP/Reference/Status#informational_responses) may be sent by a server while it is still preparing a response, with hints about the sites and resources that the server expects the final response will link to.
126
+ * This allows a browser to [preconnect](/en-US/docs/Web/HTML/Reference/Attributes/rel/preconnect) to sites or start [preloading](/en-US/docs/Web/HTML/Reference/Attributes/rel/preload) resources even before the server has prepared and sent a final response.
30
127
  * Preloaded resources indicated by early hints are fetched by the client as soon as the hints are received.
31
128
  *
32
129
  * The early hint response is primarily intended for use with the [Link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) header, which indicates the resources to be loaded.
33
- * It may also contain a [`Content-Security-Policy`](/en-US/docs/Web/HTTP/CSP) header that is enforced while processing the early hint.
130
+ * It may also contain a [`Content-Security-Policy`](/en-US/docs/Web/HTTP/Guides/CSP) header that is enforced while processing the early hint.
34
131
  *
35
132
  * A server might send multiple `103` responses, for example, following a redirect.
36
133
  * Browsers only process the first early hints response, and this response must be discarded if the request results in a cross-origin redirect.
@@ -40,10 +137,59 @@ declare enum HttpStatusCode {
40
137
  * >
41
138
  * > Most browsers limit support to HTTP/2 or later for this reason. See [browser compatibility](#browser_compatibility) below.
42
139
  * > Despite this, the examples below use HTTP/1.1-style notation as per usual convention.
140
+ *
141
+ * ## Syntax
142
+ *
143
+ * ```http
144
+ * 103 Early Hints
145
+ * ```
146
+ *
147
+ * ## Examples
148
+ *
149
+ * ### Preconnect example
150
+ *
151
+ * The following `103` early hint response shows an early hint response where the server indicates that the client might want to preconnect to a particular origin (`https://cdn.example.com`).
152
+ * Just like the HTML [`rel=preconnect`](/en-US/docs/Web/HTML/Reference/Attributes/rel/preconnect) attribute, this is a hint that the page is likely to need resources from the target resource's origin, and that the browser may improve the user experience by preemptively initiating a connection to that origin.
153
+ *
154
+ * ```http
155
+ * 103 Early Hint
156
+ * Link: ; rel=preload; as=style
157
+ * ```
158
+ *
159
+ * The early response restricts preloading to the same origin as the request.
160
+ * The stylesheet will be preloaded if the origin matches.
161
+ *
162
+ * The final response might set the CSP to `none`, as shown below.
163
+ * The stylesheet has already been preloaded, but will not be used when rendering the page.
164
+ *
165
+ * ```http
166
+ * 200 OK
167
+ * Content-Security-Policy: style-src: none;
168
+ * Content-Type: text/html
169
+ *
170
+ * <!doctype html>
171
+ * ...
172
+ * <link rel="stylesheet" rel="preload" href="style.css" />
173
+ * ...
174
+ * ```
175
+ *
176
+ * ## Specifications
177
+ *
178
+ * ## Browser compatibility
179
+ *
180
+ * ## See also
181
+ *
182
+ * - [Link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link)
183
+ * - [Cross-Origin Resource Sharing (CORS)](/en-US/docs/Web/HTTP/Guides/CORS)
184
+ * - [Content Security Policy (CSP)](/en-US/docs/Web/HTTP/Guides/CSP)
185
+ * - [`rel="preconnect"`](/en-US/docs/Web/HTML/Reference/Attributes/rel/preconnect) ([link](https://developer.mozilla.org/en-US/docs/htmlelement/link) attribute)
186
+ * - [`rel="preload"`](/en-US/docs/Web/HTML/Reference/Attributes/rel/preload) ([link](https://developer.mozilla.org/en-US/docs/htmlelement/link) attribute)
187
+ * - [`fetchpriority`](/en-US/docs/Web/HTML/Reference/Elements/link#fetchpriority) ([link](https://developer.mozilla.org/en-US/docs/htmlelement/link) attribute)
188
+ * - [Early Hints update: How Cloudflare, Google, and Shopify are working together to build a faster Internet for everyone](https://blog.cloudflare.com/early-hints-performance/) from the Cloudflare blog
43
189
  */
44
190
  EARLY_HINTS = 103,
45
191
  /**
46
- * The HTTP **`200 OK`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates that a request has succeeded.
192
+ * The HTTP **`200 OK`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates that a request has succeeded.
47
193
  * A `200 OK` response is cacheable by default.
48
194
  *
49
195
  * A `200 OK` response has a different meaning and format depending on the HTTP request method.
@@ -56,36 +202,245 @@ declare enum HttpStatusCode {
56
202
  *
57
203
  * Although possible, successful [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/PUT) or [DELETE](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/DELETE) requests often do not result in a `200 OK` response.
58
204
  * It is more common to see [201 Created](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201) if the resource is uploaded or created for the first time, or [204 No Content](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204) upon successful deletion of a resource.
205
+ *
206
+ * ## Status
207
+ *
208
+ * ```http
209
+ * 200 OK
210
+ * ```
211
+ *
212
+ * ## Examples
213
+ *
214
+ * ### Receiving a `200 OK` for a `GET` request
215
+ *
216
+ * In this example, a successful `GET` request to `https://example.com` returns a `200 OK` response.
217
+ * The response includes representation headers and a message body with the HTML content:
218
+ *
219
+ * ```http
220
+ * HTTP/1.1 200 OK
221
+ * Accept-Ranges: bytes
222
+ * Age: 294510
223
+ * Cache-Control: max-age=604800
224
+ * Content-Type: text/html; charset=UTF-8
225
+ * Date: Fri, 21 Jun 2024 14:18:33 GMT
226
+ * Etag: "3147526947"
227
+ * Expires: Fri, 28 Jun 2024 14:18:33 GMT
228
+ * Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
229
+ * Server: ECAcc (nyd/D10E)
230
+ * X-Cache: HIT
231
+ * Content-Length: 1256
232
+ *
233
+ * <!doctype html>
234
+ * <!-- HTML content follows here -->
235
+ * ```
236
+ *
237
+ * ### Receiving a `200 OK` for a `POST` request in form submission
238
+ *
239
+ * Assuming a form exists to send data to an endpoint for managing subscriptions at `http://example.com/subscribe`.
240
+ * A `POST` request to subscribe a user may look like the following:
241
+ *
242
+ * ```http
243
+ * POST /subscribe HTTP/1.1
244
+ * Host: example.com
245
+ * Content-Type: application/x-www-form-urlencoded
246
+ * Content-Length: 50
247
+ *
248
+ * name=Brian%20Smith&email=brian.smith%40example.com
249
+ * ```
250
+ *
251
+ * In this example, a response with a `200 OK` status could look like this:
252
+ *
253
+ * ```http
254
+ * HTTP/1.1 200 OK
255
+ * Content-Type: application/json
256
+ *
257
+ * {
258
+ * "message": "User subscription pending. A confirmation email has been sent.",
259
+ * "subscription": {
260
+ * "name": "Brian Smith",
261
+ * "email": "brian.smith@example.com",
262
+ * "id": 123,
263
+ * "feed": "default"
264
+ * }
265
+ * }
266
+ * ```
267
+ *
268
+ * ## Specifications
269
+ *
270
+ * ## See also
271
+ *
272
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
273
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
274
+ * - Glossary: [Idempotent](https://developer.mozilla.org/en-US/docs/Glossary/Idempotent)
59
275
  */
60
276
  OK = 200,
61
277
  /**
62
- * The HTTP **`201 Created`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates that the HTTP request has led to the creation of a resource.
278
+ * The HTTP **`201 Created`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates that the HTTP request has led to the creation of a resource.
63
279
  * This status code is commonly sent as the result of a [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/POST) request.
64
280
  *
65
281
  * The new resource, or a description and link to the new resource, is created before the response is returned.
66
282
  * The newly-created items are returned in the body of the message, located at either the **URL of the initial request** or the URL in the value of the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header in the response.
283
+ *
284
+ * ## Status
285
+ *
286
+ * ```http
287
+ * 201 Created
288
+ * ```
289
+ *
290
+ * ## Examples
291
+ *
292
+ * ### Receiving a response indicating user creation
293
+ *
294
+ * Let's assume there's a REST API for managing users with an endpoint at `http://example.com/users`. In this example, we send a `POST` request with the following body to create a user:
295
+ *
296
+ * ```http
297
+ * POST /users HTTP/1.1
298
+ * Host: example.com
299
+ * Content-Type: application/json
300
+ *
301
+ * {
302
+ * "firstName": "Brian",
303
+ * "lastName": "Smith",
304
+ * "email": "brian.smith@example.com"
305
+ * }
306
+ * ```
307
+ *
308
+ * After successful user creation, the `201 Created` response will look like this:
309
+ *
310
+ * ```http
311
+ * HTTP/1.1 201 Created
312
+ * Content-Type: application/json
313
+ * Location: http://example.com/users/123
314
+ *
315
+ * {
316
+ * "message": "New user created",
317
+ * "user": {
318
+ * "id": 123,
319
+ * "firstName": "Brian",
320
+ * "lastName": "Smith",
321
+ * "email": "brian.smith@example.com"
322
+ * }
323
+ * }
324
+ * ```
325
+ *
326
+ * ## Specifications
327
+ *
328
+ * ## See also
329
+ *
330
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
331
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
67
332
  */
68
333
  CREATED = 201,
69
334
  /**
70
- * The HTTP **`202 Accepted`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates that a request has been accepted for processing, but processing has not been completed or may not have started.
335
+ * The HTTP **`202 Accepted`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates that a request has been accepted for processing, but processing has not been completed or may not have started.
71
336
  * The actual processing of the request is not guaranteed; a task or action may fail or be disallowed when a server tries to process it.
72
337
  *
73
338
  * A `202` response is non-committal, meaning there is no way to later send an asynchronous HTTP response to indicate the outcome of the processing.
74
339
  * This response code is typically used when the request is handled by another process or server, or when requests are processed in batches.
340
+ *
341
+ * ## Status
342
+ *
343
+ * ```http
344
+ * 202 Accepted
345
+ * ```
346
+ *
347
+ * ## Examples
348
+ *
349
+ * ### Begin automated task
350
+ *
351
+ * In the following example, we want to kick off an automation process to email dog owners about a pickup task:
352
+ *
353
+ * ```http
354
+ * POST /tasks HTTP/1.1
355
+ * Host: example.com
356
+ * Content-Type: application/json
357
+ *
358
+ * {
359
+ * "task": "emailDogOwners",
360
+ * "template": "pickup"
361
+ * }
362
+ * ```
363
+ *
364
+ * The response indicates that the request to start a task was accepted for processing.
365
+ * A URL is sent in the response body so the client can track changes to the status of the task:
366
+ *
367
+ * ```http
368
+ * HTTP/1.1 202 Accepted
369
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
370
+ * Server: Apache/2.4.1 (Unix)
371
+ * Content-Type: application/json
372
+ *
373
+ * {
374
+ * "message": "Request accepted. Starting to process task.",
375
+ * "taskId": "123",
376
+ * "monitorUrl": "http://example.com/tasks/123/status"
377
+ * }
378
+ * ```
379
+ *
380
+ * ## Specifications
381
+ *
382
+ * ## See also
383
+ *
384
+ * - [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)
385
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
386
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
75
387
  */
76
388
  ACCEPTED = 202,
77
389
  /**
78
- * The HTTP **`203 Non-Authoritative Information`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates that the request was successful, but a _transforming [proxy](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server)_ has modified the headers or enclosed content from the origin server's [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) (`OK`) response.
390
+ * The HTTP **`203 Non-Authoritative Information`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates that the request was successful, but a _transforming [proxy](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server)_ has modified the headers or enclosed content from the origin server's [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) (`OK`) response.
79
391
  *
80
392
  * The purpose of this status code is to allow transforming proxies to notify clients when changes have been applied to successful responses, since this may impact decisions regarding the content later.
81
393
  * Transformations to messages can mean modifications of headers to indicate that a resource is from a mirror or a backup, but may also mean modifying content in a way that are presumed to be desirable to the client.
82
394
  * These modifications might include malware filtering, format transcoding, privacy filtering, or other hints to the client about future requests.
83
395
  *
84
- * The `203` response is similar to the [`214`](/en-US/docs/Web/HTTP/Headers/Warning#warning_codes) `Transformation Applied` value of the deprecated [Warning](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning) header, which may be applicable to responses with any status code.
396
+ * The `203` response is similar to the [`214`](/en-US/docs/Web/HTTP/Reference/Headers/Warning#warning_codes) `Transformation Applied` value of the deprecated [Warning](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning) header, which may be applicable to responses with any status code.
397
+ *
398
+ * ## Status
399
+ *
400
+ * ```http
401
+ * 203 Non-Authoritative Information
402
+ * ```
403
+ *
404
+ * ## Examples
405
+ *
406
+ * ### Receiving a filtered message response
407
+ *
408
+ * In this example, a user sends a `GET` request for content with ID `123` to `example.com`.
409
+ *
410
+ * ```http
411
+ * GET /comments/123 HTTP/1.1
412
+ * Host: example.com
413
+ * ```
414
+ *
415
+ * A proxy has altered the message based on malware filtering rules for known unsafe attachments.
416
+ * The response content has been modified, replacing the `attachment_url` value to a link with information about the filtering in place:
417
+ *
418
+ * ```http
419
+ * HTTP/1.1 203 Non-Authoritative Information
420
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
421
+ * Server: Apache/2.4.1 (Unix)
422
+ * Content-Type: application/json
423
+ * Content-Length: 123
424
+ *
425
+ * {
426
+ * "comment": "Check out my bio!",
427
+ * "attachment_url": "https://example.com/attachment-unavailable-faq"
428
+ * }
429
+ * ```
430
+ *
431
+ * ## Specifications
432
+ *
433
+ * ## See also
434
+ *
435
+ * - [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200)
436
+ * - [Proxy server](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server)
437
+ * - [Warning](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning)
438
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
439
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
85
440
  */
86
441
  NON_AUTHORITATIVE_INFORMATION = 203,
87
442
  /**
88
- * The HTTP **`204 No Content`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates that a request has succeeded, but the client doesn't need to navigate away from its current page.
443
+ * The HTTP **`204 No Content`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates that a request has succeeded, but the client doesn't need to navigate away from its current page.
89
444
  * A `204` response is cacheable by default, and an [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header is included in such cases.
90
445
  *
91
446
  * A `204 No Content` in response to these request methods has the following meaning and results:
@@ -95,10 +450,46 @@ declare enum HttpStatusCode {
95
450
  *
96
451
  * A `204` response can be used when implementing "save and continue editing" functionality for applications like wiki sites.
97
452
  * In this case, a [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/PUT) request could be used to save the page contents, and a `204 No Content` response indicates to the browser that the editor should not be replaced by other content.
453
+ *
454
+ * Note that the response must not include any content or the [Content-Length](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header (browsers may reject responses that include content).
455
+ *
456
+ * ## Status
457
+ *
458
+ * ```http
459
+ * 204 No Content
460
+ * ```
461
+ *
462
+ * ## Examples
463
+ *
464
+ * ### Receiving a response after deleting an image
465
+ *
466
+ * In this example, the client sends a request to delete an image using the `DELETE` method.
467
+ * The request includes an [Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) header with a token to authenticate the request:
468
+ *
469
+ * ```http
470
+ * DELETE /image/123 HTTP/1.1
471
+ * Host: example.com
472
+ * Authorization: Bearer 1234abcd
473
+ * ```
474
+ *
475
+ * After successfully deleting the image, the server responds with a `204` response with no body, indicating no further information needs to be sent to the client.
476
+ *
477
+ * ```http
478
+ * HTTP/1.1 204 No Content
479
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
480
+ * Server: Apache/2.4.1 (Unix)
481
+ * ```
482
+ *
483
+ * ## Specifications
484
+ *
485
+ * ## See also
486
+ *
487
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
488
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
98
489
  */
99
490
  NO_CONTENT = 204,
100
491
  /**
101
- * The HTTP **`205 Reset Content`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates that the request has been successfully processed and the client should reset the document view.
492
+ * The HTTP **`205 Reset Content`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates that the request has been successfully processed and the client should reset the document view.
102
493
  *
103
494
  * This response is intended to support use cases where the user receives content that supports data entry, submits user-edited data in a request, and the content needs to be reset for the next entry.
104
495
  * The instruction to "reset content" can mean clearing the contents of a form, resetting a canvas state, or refreshing a UI; the implementation depends on the client.
@@ -107,20 +498,135 @@ declare enum HttpStatusCode {
107
498
  * > In web applications that use the `205` status, it's assumed that the client handles resetting content after a `205` response.
108
499
  * > This is typically done via JavaScript, as resetting content such as forms after a `205` response is not handled natively by browsers.
109
500
  *
110
- * There must be no content in the response body, and this can be indicated using [Content-Length: 0](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header or [Transfer-Encoding: chunked](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding) header with an empty chunk.
501
+ * Note that the response must not include any content or the [Content-Length](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header (browsers may reject responses that include content).
502
+ * The empty response may also be indicated using the [Transfer-Encoding: chunked](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding) header with an empty chunk.
503
+ *
504
+ * ## Status
505
+ *
506
+ * ```http
507
+ * 205 Reset Content
508
+ * ```
509
+ *
510
+ * ## Examples
511
+ *
512
+ * ### Resetting a form after receiving a `205 Reset Content`
513
+ *
514
+ * The client in this example sends a `POST` request to submit a form with the comment `Hello!`:
515
+ *
516
+ * ```http
517
+ * POST /submit HTTP/1.1
518
+ * Host: example.com
519
+ * Content-Type: application/x-www-form-urlencoded
520
+ * Content-Length: 15
521
+ *
522
+ * comment=Hello!
523
+ * ```
524
+ *
525
+ * After successfully processing the form submission, the server responds with the following `205` response, indicating that the client should reset the form.
526
+ *
527
+ * ```http
528
+ * HTTP/1.1 205 Reset Content
529
+ * Content-Type: text/html; charset=utf-8
530
+ * Content-Length: 0
531
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
532
+ * ```
533
+ *
534
+ * ## Specifications
535
+ *
536
+ * ## See also
537
+ *
538
+ * - No Content
539
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
540
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
111
541
  */
112
542
  RESET_CONTENT = 205,
113
543
  /**
114
- * The HTTP **`206 Partial Content`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code is sent in response to a [range request](/en-US/docs/Web/HTTP/Range_requests).
544
+ * The HTTP **`206 Partial Content`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code is sent in response to a [range request](/en-US/docs/Web/HTTP/Guides/Range_requests).
115
545
  * The response body contains the requested ranges of data as specified in the [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) header of the request.
116
546
  *
117
547
  * The format of the response depends on the number of ranges requested.
118
548
  * If a single range is requested, the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) of the entire response is set to the type of the document, and a [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) is provided.
119
549
  * If several ranges are requested, the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) is set to `multipart/byteranges`, and each fragment covers one range, with its own [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) and [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) headers describing it.
550
+ *
551
+ * ## Status
552
+ *
553
+ * ```http
554
+ * 206 Partial Content
555
+ * ```
556
+ *
557
+ * ## Examples
558
+ *
559
+ * ### Receiving a `206` response for a single requested range
560
+ *
561
+ * The following is a sample `206` response when a single range of `21010-` (bytes 21010 to the end of file) of an image file is requested.
562
+ * The response contains [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) of `image/gif` and the [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) is provided:
563
+ *
564
+ * ```http
565
+ * GET /z4d4kWk.gif HTTP/1.1
566
+ * Host: images.example.com
567
+ * Range: bytes=21010-
568
+ * ```
569
+ *
570
+ * ```http
571
+ * HTTP/1.1 206 Partial Content
572
+ * Date: Wed, 15 Nov 2015 06:25:24 GMT
573
+ * Last-Modified: Wed, 15 Nov 2015 04:58:08 GMT
574
+ * Content-Range: bytes 21010-47021/47022
575
+ * Content-Length: 26012
576
+ * Content-Type: image/gif
577
+ * ETag: "abc123"
578
+ * Accept-Ranges: bytes
579
+ *
580
+ * # 26012 bytes of partial image data…
581
+ * ```
582
+ *
583
+ * ### Receiving a `206` response for multiple requested ranges
584
+ *
585
+ * Following is a sample `206` response when two ranges of a PDF file are requested.
586
+ * The response contains the `multipart/byteranges` [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) with a separate [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) (`application/pdf`) and [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) for each range.
587
+ *
588
+ * ```http
589
+ * GET /price-list.pdf HTTP/1.1
590
+ * Host: example.com
591
+ * Range: bytes=234-639,4590-7999
592
+ * ```
593
+ *
594
+ * ```http
595
+ * HTTP/1.1 206 Partial Content
596
+ * Date: Wed, 15 Nov 2015 06:25:24 GMT
597
+ * Last-Modified: Wed, 15 Nov 2015 04:58:08 GMT
598
+ * Content-Length: 1741
599
+ * Content-Type: multipart/byteranges; boundary=String_separator
600
+ * ETag: "abc123"
601
+ * Accept-Ranges: bytes
602
+ *
603
+ * --String_separator
604
+ * Content-Type: application/pdf
605
+ * Content-Range: bytes 234-639/8000
606
+ *
607
+ * # content of first range (406 bytes)
608
+ * --String_separator
609
+ * Content-Type: application/pdf
610
+ * Content-Range: bytes 4590-7999/8000
611
+ *
612
+ * # content of second range (3410 bytes)
613
+ * --String_separator--
614
+ * ```
615
+ *
616
+ * ## Specifications
617
+ *
618
+ * ## See also
619
+ *
620
+ * - [If-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Range)
621
+ * - [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range)
622
+ * - [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
623
+ * - [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)
624
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
625
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
120
626
  */
121
627
  PARTIAL_CONTENT = 206,
122
628
  /**
123
- * The HTTP **`207 Multi-Status`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates a mixture of responses.
629
+ * The HTTP **`207 Multi-Status`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates a mixture of responses.
124
630
  * This response is used exclusively in the context of Web Distributed Authoring and Versioning ([WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV)).
125
631
  *
126
632
  * The response body is a `text/xml` or `application/xml` HTTP entity with a `multistatus` root element that lists individual response codes.
@@ -128,10 +634,40 @@ declare enum HttpStatusCode {
128
634
  * > [!NOTE]
129
635
  * > Browsers accessing web pages will never encounter this status code.
130
636
  * > The ability to return a _collection of resources_ is part of the [WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV) protocol and is only encountered by web applications that access a WebDAV server.
637
+ *
638
+ * ## Status
639
+ *
640
+ * ```http
641
+ * 207 Multi-Status
642
+ * ```
643
+ *
644
+ * ## Examples
645
+ *
646
+ * ### Receiving a `207` response in a WebDAV context
647
+ *
648
+ * The following response is an example `207` response that a [WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV) server sends to a client.
649
+ * There is a `multistatus` root element with details of the individual collections:
650
+ *
651
+ * ```http
652
+ * HTTP/1.1 207 Multi-Status
653
+ * Content-Type: application/xml; charset="utf-8"
654
+ * Content-Length: 1241
655
+ *
656
+ *
657
+ * ```
658
+ *
659
+ * ## Specifications
660
+ *
661
+ * ## See also
662
+ *
663
+ * - [204](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204)
664
+ * - [403](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403)
665
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
666
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
131
667
  */
132
668
  MULTI_STATUS = 207,
133
669
  /**
134
- * The HTTP **`208 Already Reported`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code is used in a [207 Multi-Status](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/207) response to save space and avoid conflicts.
670
+ * The HTTP **`208 Already Reported`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code is used in a [207 Multi-Status](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/207) response to save space and avoid conflicts.
135
671
  * This response is used exclusively in the context of Web Distributed Authoring and Versioning ([WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV)).
136
672
  *
137
673
  * If the same resource is requested several times (for example, as part of a collection) with different paths, only the first one is reported with [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200).
@@ -140,10 +676,33 @@ declare enum HttpStatusCode {
140
676
  * > [!NOTE]
141
677
  * > The ability to _bind_ a resource to several paths is an extension to the [WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV) protocol (it may be received by web applications accessing a WebDAV server).
142
678
  * > Browsers accessing web pages will never encounter this status code.
679
+ *
680
+ * ## Status
681
+ *
682
+ * ```http
683
+ * 208 Already Reported
684
+ * ```
685
+ *
686
+ * ## Examples
687
+ *
688
+ * ### Receiving a `208` in a `207 Multi-Status` response
689
+ *
690
+ * The following is a sample `207 Multi-Status` response from a WebDAV server, which includes a `208` response.
691
+ * Notice the `208` in the last `
692
+ * ```
693
+ *
694
+ * ## Specifications
695
+ *
696
+ * ## See also
697
+ *
698
+ * - [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200)
699
+ * - [508 Loop Detected](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/508)
700
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
701
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
143
702
  */
144
703
  ALREADY_REPORTED = 208,
145
704
  /**
146
- * The HTTP **`226 IM Used`** [successful response](/en-US/docs/Web/HTTP/Status#successful_responses) status code indicates that the server is returning a [delta](https://developer.mozilla.org/en-US/docs/Glossary/delta) in response to a [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) request.
705
+ * The HTTP **`226 IM Used`** [successful response](/en-US/docs/Web/HTTP/Reference/Status#successful_responses) status code indicates that the server is returning a [delta](https://developer.mozilla.org/en-US/docs/Glossary/delta) in response to a [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) request.
147
706
  * It is used in the context of _HTTP delta encodings_.
148
707
  *
149
708
  * IM stands for _instance manipulation_, which refers to the algorithm generating a _delta_.
@@ -153,28 +712,137 @@ declare enum HttpStatusCode {
153
712
  *
154
713
  * > [!WARNING]
155
714
  * > Poor support for HTTP delta encodings means there are few implementations.
156
- * > Instead, most systems rely solely on [compression methods](/en-US/docs/Web/HTTP/Compression) to reduce bandwidth, although a combination of compression and delta encodings is possible.
715
+ * > Instead, most systems rely solely on [compression methods](/en-US/docs/Web/HTTP/Guides/Compression) to reduce bandwidth, although a combination of compression and delta encodings is possible.
157
716
  * >
158
717
  * > Even if the client and server support delta encodings, proxies or caches may not, and the complexity of adding HTTP delta encodings to a system may outweigh the benefits.
718
+ *
719
+ * ## Status
720
+ *
721
+ * ```http
722
+ * 226 IM Used
723
+ * ```
724
+ *
725
+ * ## Examples
726
+ *
727
+ * ### Receiving a `208` with the `vcdiff` delta algorithm
728
+ *
729
+ * In the following `GET` request, a client requests a resource and has a cached version with the ETag `abcd123`.
730
+ * The `A-IM:` header indicates a preference for `vcdiff` and `diffe` delta algorithms:
731
+ *
732
+ * ```http
733
+ * GET /resource.txt HTTP/1.1
734
+ * Host: example.com
735
+ * A-IM: vcdiff, diffe
736
+ * If-None-Match: "abcd123"
737
+ * ```
738
+ *
739
+ * Assuming the server supports delta encodings, it responds with the diff since the version with the ETag `abcd123`.
740
+ * The `IM` header indicates that the `vcdiff` algorithm is used, and the `Delta-Base:` header indicates that the diff is based on a resource with ETag `abcd123`.
741
+ *
742
+ * ```http
743
+ * HTTP/1.1 226 IM Used
744
+ * ETag: "5678a23"
745
+ * IM: vcdiff
746
+ * Content-Type: text/plain
747
+ * Content-Length: 123
748
+ * Delta-Base: abcd123
749
+ *
750
+ * ...
751
+ * ```
752
+ *
753
+ * ## Specifications
754
+ *
755
+ * ## See also
756
+ *
757
+ * - [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200)
758
+ * - [HTTP request methods](/en-US/docs/Web/HTTP/Reference/Methods)
759
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
760
+ * - [Syndication feed deltas help reduce subscription bandwidth costs](https://www.ctrl.blog/entry/feed-delta-updates.html) (2017)
159
761
  */
160
762
  IM_USED = 226,
161
763
  /**
162
- * The HTTP **`300 Multiple Choices`** [redirection response](/en-US/docs/Web/HTTP/Status#redirection_messages) status code indicates that the request has more than one possible response.
764
+ * The HTTP **`300 Multiple Choices`** [redirection response](/en-US/docs/Web/HTTP/Reference/Status#redirection_messages) status code indicates that the request has more than one possible response.
163
765
  * The user-agent or the user should choose one of them.
164
766
  *
165
767
  * > [!NOTE]
166
- * > In [agent-driven content negotiation](/en-US/docs/Web/HTTP/Content_negotiation#agent-driven_negotiation), a client and server collaboratively decide the best variant of a given resource when the server has multiple variants.
768
+ * > In [agent-driven content negotiation](/en-US/docs/Web/HTTP/Guides/Content_negotiation#agent-driven_negotiation), a client and server collaboratively decide the best variant of a given resource when the server has multiple variants.
167
769
  * > Most clients lack a method for automatically choosing from responses, and the additional round-trips slow down client-server interaction.
168
- * > [Server-driven content negotiation](/en-US/docs/Web/HTTP/Content_negotiation#server-driven_content_negotiation) is far more common, where a server chooses the most appropriate resource for the client based on the request headers ([Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language), [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept), etc.).
770
+ * > [Server-driven content negotiation](/en-US/docs/Web/HTTP/Guides/Content_negotiation#server-driven_content_negotiation) is far more common, where a server chooses the most appropriate resource for the client based on the request headers ([Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language), [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept), etc.).
169
771
  *
170
772
  * The server should include content in the response that contains a list of resource metadata and URIs from which the user or user agent can choose.
171
773
  * The format of the content is implementation-specific, but should be easily parsed by the user agent (such as HTML or JSON).
172
774
  *
173
775
  * If the server has a preferred choice that the client should request, it can include it in a [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
776
+ *
777
+ * ## Status
778
+ *
779
+ * ```http
780
+ * 300 Multiple Choices
781
+ * ```
782
+ *
783
+ * ## Examples
784
+ *
785
+ * ### 300 response with list of resources
786
+ *
787
+ * The following example demonstrates a Transparent Content Negotiation request-response exchange.
788
+ * An Apache server offers multiple variants of a resource defined in a [type map](https://httpd.apache.org/docs/trunk/mod/mod_negotiation.html#typemaps); `index.html.en` for a resource in English, and `index.html.fr` for a French version:
789
+ *
790
+ * ```http
791
+ * URI: index.html.en
792
+ * Content-Language: en
793
+ *
794
+ * URI: index.html.fr
795
+ * Content-Language: fr
796
+ * ```
797
+ *
798
+ * A `Negotiate: trans` request header indicates that the client wants to use TCN to choose a resource.
799
+ * Poor browser support for this mechanism means a user agent such as curl must be used instead:
800
+ *
801
+ * ```bash
802
+ * curl -v -H "Negotiate: trans" http://localhost/index
803
+ * ```
804
+ *
805
+ * This produces the following request:
806
+ *
807
+ * ```http
808
+ * GET /index HTTP/1.1
809
+ * Host: localhost
810
+ * User-Agent: curl/8.7.1
811
+ * Accept: * /*
812
+ * Negotiate: trans
813
+ * ```
814
+ *
815
+ * We receive a `300` response with details of different representations of the requested resource:
816
+ *
817
+ * ```http
818
+ * HTTP/1.1 300 Multiple Choices
819
+ * Date: Fri, 30 Aug 2024 09:21:48 GMT
820
+ * Server: Apache/2.4.59 (Unix)
821
+ * Alternates: {"index.html.en" 1 {type text/html} {language en} {length 48}}, {"index.html.fr" 1 {type text/html} {language fr} {length 45}}
822
+ * Vary: negotiate,accept-language
823
+ * TCN: list
824
+ * Content-Length: 419
825
+ * Content-Type: text/html; charset=iso-8859-1
826
+ *
827
+ *
828
+ * ```
829
+ *
830
+ * ## Specifications
831
+ *
832
+ * ## See also
833
+ *
834
+ * - [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections)
835
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
836
+ * - [301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301)
837
+ * - [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) temporary redirect
838
+ * - [308 Permanent Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308)
839
+ * - [506 Variant Also Negotiates](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/506)
840
+ * - [Apache Server Negotiation Algorithm](https://httpd.apache.org/docs/current/en/content-negotiation.html#algorithm)
841
+ * - [Transparent Content Negotiation in HTTP](https://developer.mozilla.org/en-US/docs/RFC/2295)
174
842
  */
175
843
  MULTIPLE_CHOICES = 300,
176
844
  /**
177
- * The HTTP **`301 Moved Permanently`** [redirection response](/en-US/docs/Web/HTTP/Status#redirection_messages) status code indicates that the requested resource has been permanently moved to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
845
+ * The HTTP **`301 Moved Permanently`** [redirection response](/en-US/docs/Web/HTTP/Reference/Status#redirection_messages) status code indicates that the requested resource has been permanently moved to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
178
846
  *
179
847
  * A browser receiving this status will automatically request the resource at the URL in the `Location` header, redirecting the user to the new page.
180
848
  * Search engines receiving this response will attribute links to the original URL to the redirected resource, passing the [SEO](https://developer.mozilla.org/en-US/docs/Glossary/SEO) ranking to the new URL.
@@ -182,10 +850,51 @@ declare enum HttpStatusCode {
182
850
  * > [!NOTE]
183
851
  * > In the [Fetch Standard](https://fetch.spec.whatwg.org/#http-redirect-fetch), when a user agent receives a `301` in response to a [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/POST) request, it uses the [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) method in the subsequent redirection request, as permitted by the HTTP [specification](#specifications).
184
852
  * > To avoid user agents modifying the request, use [308 Permanent Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308) instead, as altering the method after a `308` response is prohibited.
853
+ *
854
+ * ## Status
855
+ *
856
+ * ```http
857
+ * 301 Moved Permanently
858
+ * ```
859
+ *
860
+ * ## Examples
861
+ *
862
+ * ### 301 response to a moved resource
863
+ *
864
+ * The following [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) request is made to a resource with a `301` redirection in place.
865
+ *
866
+ * ```http
867
+ * GET /en-US/docs/AJAX HTTP/2
868
+ * Host: developer.mozilla.org
869
+ * User-Agent: curl/8.6.0
870
+ * Accept: * /*
871
+ * ```
872
+ *
873
+ * The response includes the `301` status along with the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header that indicates the URL where the resource has moved.
874
+ *
875
+ * ```http
876
+ * HTTP/2 301
877
+ * cache-control: max-age=2592000,public
878
+ * location: /en-US/docs/Learn_web_development/Core/Scripting/Network_requests
879
+ * content-type: text/plain; charset=utf-8
880
+ * date: Fri, 19 Jul 2024 12:57:17 GMT
881
+ * content-length: 97
882
+ *
883
+ * Moved Permanently. Redirecting to /en-US/docs/Learn_web_development/Core/Scripting/Network_requests
884
+ * ```
885
+ *
886
+ * ## Specifications
887
+ *
888
+ * ## See also
889
+ *
890
+ * - [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections)
891
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
892
+ * - [308 Permanent Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308) equivalent to `301`, but the request method is not modified
893
+ * - [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) temporary redirect
185
894
  */
186
895
  MOVED_PERMANENTLY = 301,
187
896
  /**
188
- * The HTTP **`302 Found`** [redirection response](/en-US/docs/Web/HTTP/Status#redirection_messages) status code indicates that the requested resource has been temporarily moved to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
897
+ * The HTTP **`302 Found`** [redirection response](/en-US/docs/Web/HTTP/Reference/Status#redirection_messages) status code indicates that the requested resource has been temporarily moved to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
189
898
  *
190
899
  * A browser receiving this status will automatically request the resource at the URL in the `Location` header, redirecting the user to the new page.
191
900
  * Search engines receiving this response will not attribute links to the original URL to the new resource, meaning no [SEO](https://developer.mozilla.org/en-US/docs/Glossary/SEO) value is transferred to the new URL.
@@ -196,21 +905,92 @@ declare enum HttpStatusCode {
196
905
  * >
197
906
  * > In cases where you want any request method to be changed to [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET), use [303 See Other](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303).
198
907
  * > This is useful when you want to give a response to a [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/PUT) method that is not the uploaded resource but a confirmation message such as: "you successfully uploaded XYZ".
908
+ *
909
+ * ## Status
910
+ *
911
+ * ```http
912
+ * 302 Found
913
+ * ```
914
+ *
915
+ * ## Examples
916
+ *
917
+ * ### 302 response with new URL
918
+ *
919
+ * ```http
920
+ * GET /profile HTTP/1.1
921
+ * Host: www.example.com
922
+ * ```
923
+ *
924
+ * ```http
925
+ * HTTP/1.1 302 Found
926
+ * Location: https://www.example.com/new-profile-url
927
+ * Content-Type: text/html; charset=UTF-8
928
+ * Content-Length: 0
929
+ * ```
930
+ *
931
+ * ## Specifications
932
+ *
933
+ * ## See also
934
+ *
935
+ * - [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections)
936
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
937
+ * - [307 Temporary Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307), equivalent to `302` but the request method is not modified
938
+ * - [303 See Other](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303), a temporary redirect that changes the method to [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET)
939
+ * - [301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301), a permanent redirect.
199
940
  */
200
941
  FOUND = 302,
201
942
  /**
202
- * The HTTP **`303 See Other`** [redirection response](/en-US/docs/Web/HTTP/Status#redirection_messages) status code indicates that the browser should redirect to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header instead of rendering the requested resource.
943
+ * The HTTP **`303 See Other`** [redirection response](/en-US/docs/Web/HTTP/Reference/Status#redirection_messages) status code indicates that the browser should redirect to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header instead of rendering the requested resource.
203
944
  *
204
945
  * This response code is often sent back as a result of [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/PUT) or [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/POST) methods so the client may retrieve a confirmation, or view a representation of a real-world object (see [HTTP range-14](https://en.wikipedia.org/wiki/HTTPRange-14)).
205
946
  * The method to retrieve the redirected resource is always [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET).
947
+ *
948
+ * ## Status
949
+ *
950
+ * ```http
951
+ * 303 See Other
952
+ * ```
953
+ *
954
+ * ## Examples
955
+ *
956
+ * ### 303 response on form submission
957
+ *
958
+ * The client in this example sends a [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/POST) request to submit a form to a generic subscription.
959
+ *
960
+ * ```http
961
+ * POST /subscribe HTTP/1.1
962
+ * Host: example.com
963
+ * Content-Type: application/x-www-form-urlencoded
964
+ * Content-Length: 50
965
+ *
966
+ * name=Brian%20Smith&email=brian.smith%40example.com
967
+ * ```
968
+ *
969
+ * The server may send back a response with a `303` status and a confirmation page in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header, so the user is redirected there after receiving the response.
970
+ *
971
+ * ```http
972
+ * HTTP/1.1 303 See Other
973
+ * Location: https://www.example.com/confirmation/event/123
974
+ * Content-Type: text/html; charset=UTF-8
975
+ * Content-Length: 0
976
+ * ```
977
+ *
978
+ * ## Specifications
979
+ *
980
+ * ## See also
981
+ *
982
+ * - [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections)
983
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
984
+ * - [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302), a temporary redirect
985
+ * - [307 Temporary Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307), a temporary redirect where the request method is not modified
206
986
  */
207
987
  SEE_OTHER = 303,
208
988
  /**
209
- * The HTTP **`304 Not Modified`** [redirection response](/en-US/docs/Web/HTTP/Status#redirection_messages) status code indicates that there is no need to retransmit the requested resources.
989
+ * The HTTP **`304 Not Modified`** [redirection response](/en-US/docs/Web/HTTP/Reference/Status#redirection_messages) status code indicates that there is no need to retransmit the requested resources.
210
990
  *
211
- * This response code is sent when the request is a [conditional](/en-US/docs/Web/HTTP/Conditional_requests) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) or [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/HEAD) request with an [If-None-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) or an [If-Modified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since) header and the condition evaluates to 'false'.
991
+ * This response code is sent when the request is a [conditional](/en-US/docs/Web/HTTP/Guides/Conditional_requests) [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) or [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/HEAD) request with an [If-None-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) or an [If-Modified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since) header and the condition evaluates to 'false'.
212
992
  * It confirms that the resource cached by the client is still valid and that the server would have sent a [200 OK](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) response with the resource if the condition evaluated to 'true'.
213
- * See [HTTP caching](/en-US/docs/Web/HTTP/Caching) for more information.
993
+ * See [HTTP caching](/en-US/docs/Web/HTTP/Guides/Caching) for more information.
214
994
  *
215
995
  * The response must not contain a body and must include the headers that would have been sent in an equivalent [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) response, such as:
216
996
  *
@@ -223,10 +1003,102 @@ declare enum HttpStatusCode {
223
1003
  *
224
1004
  * > [!NOTE]
225
1005
  * > Many [developer tools' network panels](https://firefox-source-docs.mozilla.org/devtools-user/network_monitor/index.html) of browsers create extraneous requests leading to `304` responses, so that access to the local cache is visible to developers.
1006
+ *
1007
+ * ## Status
1008
+ *
1009
+ * ```http
1010
+ * 304 Not Modified
1011
+ * ```
1012
+ *
1013
+ * ## Examples
1014
+ *
1015
+ * ### 304 response to conditional requests
1016
+ *
1017
+ * The examples below show [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) requests made using [curl](https://curl.se/) with conditional request headers.
1018
+ * The `--http1.1` flag is used to force the HTTP/1.1 protocol for readability.
1019
+ *
1020
+ * The first request uses an `If-Modified-Since` condition with a future date of 21st November 2050.
1021
+ * This must evaluate to `false`, because the resource can't have been updated after a time that hasn't happened yet:
1022
+ *
1023
+ * ```bash
1024
+ * curl --http1.1 -I --header 'If-Modified-Since: Tue, 21 Nov 2050 08:00:00 GMT' \
1025
+ * https://developer.mozilla.org/en-US/
1026
+ * ```
1027
+ *
1028
+ * This will result in the following HTTP request:
1029
+ *
1030
+ * ```http
1031
+ * GET /en-US/ HTTP/1.1
1032
+ * Host: developer.mozilla.org
1033
+ * User-Agent: curl/8.7.1
1034
+ * Accept: * /*
1035
+ * If-Modified-Since: Tue, 21 Nov 2050 08:00:00 GMT
1036
+ * ```
1037
+ *
1038
+ * The response would be [200 OK](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) with the current version of the resource if the resource had been updated after the timestamp in the [If-Modified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since) header.
1039
+ * Instead, we get a `304` response that includes [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag), [Age](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age) and [Expires](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires) headers, telling us our cached version of the resource is still current:
1040
+ *
1041
+ * ```http
1042
+ * HTTP/1.1 304 Not Modified
1043
+ * Date: Wed, 28 Aug 2024 09:52:35 GMT
1044
+ * Expires: Wed, 28 Aug 2024 10:01:53 GMT
1045
+ * Age: 3279
1046
+ * ETag: "b20a0973b226eeea30362acb81f9e0b3"
1047
+ * Cache-Control: public, max-age=3600
1048
+ * Vary: Accept-Encoding
1049
+ * X-cache: hit
1050
+ * Alt-Svc: clear
1051
+ * ```
1052
+ *
1053
+ * Now run another `curl` command using the `etag` value from the previous response with the [If-None-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) condition (since this `etag` is the current version of the resource on the server we expect to receive a `304 Not Modified` response):
1054
+ *
1055
+ * ```bash
1056
+ * curl --http1.1 -I --header 'If-None-Match: "b20a0973b226eeea30362acb81f9e0b3"' \
1057
+ * https://developer.mozilla.org/en-US/
1058
+ * ```
1059
+ *
1060
+ * This will result in the following HTTP request:
1061
+ *
1062
+ * ```http
1063
+ * GET /en-US/ HTTP/1.1
1064
+ * Host: developer.mozilla.org
1065
+ * User-Agent: curl/8.7.1
1066
+ * Accept: * /*
1067
+ * If-None-Match: "b20a0973b226eeea30362acb81f9e0b3"
1068
+ * ```
1069
+ *
1070
+ * Because the `etag` value matches at the time of the request, the entity tag fails the condition, and a `304` response is returned:
1071
+ *
1072
+ * ```http
1073
+ * HTTP/1.1 304 Not Modified
1074
+ * Date: Wed, 28 Aug 2024 10:36:35 GMT
1075
+ * Expires: Wed, 28 Aug 2024 11:02:17 GMT
1076
+ * Age: 662
1077
+ * ETag: "b20a0973b226eeea30362acb81f9e0b3"
1078
+ * Cache-Control: public, max-age=3600
1079
+ * Vary: Accept-Encoding
1080
+ * X-cache: hit
1081
+ * Alt-Svc: clear
1082
+ * ```
1083
+ *
1084
+ * ## Specifications
1085
+ *
1086
+ * ## Compatibility notes
1087
+ *
1088
+ * Browser behavior differs if this response erroneously includes a body on persistent connections.
1089
+ * See [204 No Content](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204) for more details.
1090
+ *
1091
+ * ## See also
1092
+ *
1093
+ * - [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections)
1094
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1095
+ * - [HTTP conditional requests](/en-US/docs/Web/HTTP/Guides/Conditional_requests)
1096
+ * - [If-Modified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since)
1097
+ * - [If-None-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match)
226
1098
  */
227
1099
  NOT_MODIFIED = 304,
228
1100
  /**
229
- * The HTTP **`307 Temporary Redirect`** [redirection response](/en-US/docs/Web/HTTP/Status#redirection_messages) status code indicates that the resource requested has been temporarily moved to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
1101
+ * The HTTP **`307 Temporary Redirect`** [redirection response](/en-US/docs/Web/HTTP/Reference/Status#redirection_messages) status code indicates that the resource requested has been temporarily moved to the URL in the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
230
1102
  *
231
1103
  * A browser receiving this status will automatically request the resource at the URL in the `Location` header, redirecting the user to the new page.
232
1104
  * Search engines receiving this response will not attribute links to the original URL to the new resource, meaning no [SEO](https://developer.mozilla.org/en-US/docs/Glossary/SEO) value is transferred to the new URL.
@@ -238,10 +1110,47 @@ declare enum HttpStatusCode {
238
1110
  * The difference between `307` and [302](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) is that `307` guarantees that the client **will not change** the request method and body when the redirected request is made.
239
1111
  * With `302`, older clients incorrectly changed the method to [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET).
240
1112
  * `307` and `302` responses are identical when the request method is [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET).
1113
+ *
1114
+ * ## Status
1115
+ *
1116
+ * ```http
1117
+ * 307 Temporary Redirect
1118
+ * ```
1119
+ *
1120
+ * ## Examples
1121
+ *
1122
+ * ### 307 response to a moved resource
1123
+ *
1124
+ * The following [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) request to is made to a resource that has a `307` redirection in place.
1125
+ * The [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header provides the URL of the redirected resource.
1126
+ *
1127
+ * ```http
1128
+ * GET /en-US/docs/AJAX HTTP/2
1129
+ * Host: developer.mozilla.org
1130
+ * User-Agent: curl/8.6.0
1131
+ * Accept: * /*
1132
+ * ```
1133
+ *
1134
+ * ```http
1135
+ * HTTP/2 307
1136
+ * location: /en-US/docs/Learn_web_development/Core/Scripting/Network_requests
1137
+ * content-type: text/plain; charset=utf-8
1138
+ * date: Fri, 19 Jul 2024 12:57:17 GMT
1139
+ * ```
1140
+ *
1141
+ * ## Specifications
1142
+ *
1143
+ * ## See also
1144
+ *
1145
+ * - [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections)
1146
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1147
+ * - [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302), the equivalent to `307`, but may modify non-[GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) methods
1148
+ * - [303 See Other](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303), temporary redirect that modifies the request method to [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET)
1149
+ * - [301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301), a permanent redirect
241
1150
  */
242
1151
  TEMPORARY_REDIRECT = 307,
243
1152
  /**
244
- * The HTTP **`308 Permanent Redirect`** [redirection response](/en-US/docs/Web/HTTP/Status#redirection_messages) status code indicates that the requested resource has been permanently moved to the URL given by the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
1153
+ * The HTTP **`308 Permanent Redirect`** [redirection response](/en-US/docs/Web/HTTP/Reference/Status#redirection_messages) status code indicates that the requested resource has been permanently moved to the URL given by the [Location](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header.
245
1154
  *
246
1155
  * A browser receiving this status will automatically request the resource at the URL in the `Location` header, redirecting the user to the new page.
247
1156
  * Search engines receiving this response will attribute links to the original URL to the redirected resource, passing the [SEO](https://developer.mozilla.org/en-US/docs/Glossary/SEO) ranking to the new URL.
@@ -252,41 +1161,268 @@ declare enum HttpStatusCode {
252
1161
  * > [!NOTE]
253
1162
  * > Some Web applications may use the `308 Permanent Redirect` in a non-standard way and for different purposes.
254
1163
  * > For example, Google Drive uses a `308 Resume Incomplete` response to indicate to the client when an unfinished upload has stalled.
255
- * > See [Perform a resumable download](https://developers.google.com/drive/api/guides/manage-uploads) on the Google Drive documentation for more information.
1164
+ * > See [Perform a resumable download](https://developers.google.com/workspace/drive/api/guides/manage-uploads) on the Google Drive documentation for more information.
1165
+ *
1166
+ * ## Status
1167
+ *
1168
+ * ```http
1169
+ * 308 Permanent Redirect
1170
+ * ```
1171
+ *
1172
+ * ## Examples
1173
+ *
1174
+ * ### 308 response to a moved resource
1175
+ *
1176
+ * ```http
1177
+ * GET /featured HTTP/1.1
1178
+ * Host: www.example.org
1179
+ * ```
1180
+ *
1181
+ * ```http
1182
+ * HTTP/1.1 308 Permanent Redirect
1183
+ * Location: http://www.example.com/featured
1184
+ * Content-Length: 0
1185
+ * ```
1186
+ *
1187
+ * ## Specifications
1188
+ *
1189
+ * ## Browser compatibility
1190
+ *
1191
+ * ## See also
1192
+ *
1193
+ * - [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections)
1194
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1195
+ * - [301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301), the equivalent of this status code that may modify the request method when it is not a [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET)
1196
+ * - [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302), a temporary redirect
256
1197
  */
257
1198
  PERMANENT_REDIRECT = 308,
258
1199
  /**
259
- * The HTTP **`400 Bad Request`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server would not process the request due to something the server considered to be a client error.
1200
+ * The HTTP **`400 Bad Request`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server would not process the request due to something the server considered to be a client error.
260
1201
  * The reason for a `400` response is typically due to malformed request syntax, invalid request message framing, or deceptive request routing.
261
1202
  *
262
1203
  * Clients that receive a `400` response should expect that repeating the request without modification will fail with the same error.
1204
+ *
1205
+ * ## Status
1206
+ *
1207
+ * ```http
1208
+ * 400 Bad Request
1209
+ * ```
1210
+ *
1211
+ * ## Examples
1212
+ *
1213
+ * ### Malformed request syntax
1214
+ *
1215
+ * Assuming a [REST](https://developer.mozilla.org/en-US/docs/Glossary/REST) API exists with an endpoint to manage users at `http://example.com/users` and a `POST` request with the following body attempts to create a user, but uses invalid JSON with unescaped line breaks:
1216
+ *
1217
+ * ```http
1218
+ * POST /users HTTP/1.1
1219
+ * Host: example.com
1220
+ * Content-Type: application/json
1221
+ * Content-Length: 38
1222
+ *
1223
+ * {
1224
+ * "email": "b@example.com
1225
+ * ",
1226
+ * "username": "b.smith"
1227
+ * }
1228
+ * ```
1229
+ *
1230
+ * If the [content](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_Content) is in a valid format, we would expect a [201 Created](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201) response or another success message, but instead the server responds with a `400` and the response body includes a `message` field with some context so the client can retry the action with a properly-formed request:
1231
+ *
1232
+ * ```http
1233
+ * HTTP/1.1 400 Bad Request
1234
+ * Content-Type: application/json
1235
+ * Content-Length: 71
1236
+ *
1237
+ * {
1238
+ * "error": "Bad request",
1239
+ * "message": "Request body could not be read properly.",
1240
+ * }
1241
+ * ```
1242
+ *
1243
+ * ## Specifications
1244
+ *
1245
+ * ## See also
1246
+ *
1247
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1248
+ * - [HTTP Status Code Definitions](https://httpwg.org/specs/rfc9110.html#status.400)
263
1249
  */
264
1250
  BAD_REQUEST = 400,
265
1251
  /**
266
- * The HTTP **`401 Unauthorized`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that a request was not successful because it lacks valid authentication credentials for the requested resource.
267
- * This status code is sent with an HTTP [WWW-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate) response header that contains information on the [authentication scheme](/en-US/docs/Web/HTTP/Authentication#authentication_schemes) the server expects the client to include to make the request successfully.
1252
+ * The HTTP **`401 Unauthorized`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that a request was not successful because it lacks valid authentication credentials for the requested resource.
1253
+ * This status code is sent with an HTTP [WWW-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate) response header that contains information on the [authentication scheme](/en-US/docs/Web/HTTP/Guides/Authentication#authentication_schemes) the server expects the client to include to make the request successfully.
268
1254
  *
269
1255
  * A `401 Unauthorized` is similar to the [403 Forbidden](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403) response, except that a 403 is returned when a request contains valid credentials, but the client does not have permissions to perform a certain action.
1256
+ *
1257
+ * ## Status
1258
+ *
1259
+ * ```http
1260
+ * 401 Unauthorized
1261
+ * ```
1262
+ *
1263
+ * ## Examples
1264
+ *
1265
+ * ### Unauthorized request to a protected API
1266
+ *
1267
+ * The following GET request is made to a URL `www.example.com/admin` that expects credentials in an [Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) header:
1268
+ *
1269
+ * ```http
1270
+ * GET /admin HTTP/1.1
1271
+ * Host: example.com
1272
+ * ```
1273
+ *
1274
+ * The server responds with a 401 message and a [WWW-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate) header indicating that the request must be authenticated and that `Bearer` auth (an access token) is the permitted [authentication scheme](/en-US/docs/Web/HTTP/Guides/Authentication#authentication_schemes):
1275
+ *
1276
+ * ```http
1277
+ * HTTP/1.1 401 Unauthorized
1278
+ * Date: Tue, 02 Jul 2024 12:18:47 GMT
1279
+ * WWW-Authenticate: Bearer
1280
+ * ```
1281
+ *
1282
+ * ## Specifications
1283
+ *
1284
+ * ## See also
1285
+ *
1286
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1287
+ * - [HTTP authentication](/en-US/docs/Web/HTTP/Guides/Authentication)
1288
+ * - [Challenge](https://developer.mozilla.org/en-US/docs/Glossary/Challenge)
1289
+ * - [WWW-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate)
1290
+ * - [Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization)
1291
+ * - [Proxy-Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization)
1292
+ * - [Proxy-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authenticate)
1293
+ * - [403](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403), [407](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/407)
270
1294
  */
271
1295
  UNAUTHORIZED = 401,
272
1296
  /**
273
- * The HTTP **`402 Payment Required`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code is a **nonstandard** response status code reserved for future use.
1297
+ * The HTTP **`402 Payment Required`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code is a **nonstandard** response status code reserved for future use.
274
1298
  *
275
1299
  * This status code was created to enable digital cash or (micro) payment systems and would indicate that requested content is not available until the client makes a payment.
276
1300
  * No standard use convention exists and different systems use it in different contexts.
1301
+ *
1302
+ * ## Status
1303
+ *
1304
+ * ```http
1305
+ * 402 Payment Required
1306
+ * ```
1307
+ *
1308
+ * ## Examples
1309
+ *
1310
+ * ### Payment API failure
1311
+ *
1312
+ * Some payment APIs use the 402 response as a generic catch-all for failed payment requests.
1313
+ * The following example tries to make a call to a payment API using a POST request to initiate a transaction:
1314
+ *
1315
+ * ```http
1316
+ * POST /merchant/transfers/payment HTTP/1.1
1317
+ * Host: payments.example.com
1318
+ * Content-Type: application/json
1319
+ * Content-Length: 402
1320
+ *
1321
+ * {
1322
+ * "payment_transfer": {
1323
+ * "reference": "PAYMENT123456",
1324
+ * "amount": "1337",
1325
+ * "currency": "EUR",
1326
+ * "sender_account_uri": "pan:5299920000000149;exp=2020-08;cvc=123",
1327
+ * "sender": {
1328
+ * "first_name": "Amelia",
1329
+ * "middle_name": "Rosenburg",
1330
+ * "email": "test123@sender.example.com"
1331
+ * },
1332
+ * "recipient": {
1333
+ * "first_name": "Tyrone",
1334
+ * "middle_name": "Johnston",
1335
+ * "email": "test123@example.com",
1336
+ * "merchant_id": "123"
1337
+ * },
1338
+ * "authentication_value": "ucaf:jJJLtQa+Iws8AREAEbjsA1MAAAA",
1339
+ * }
1340
+ * }
1341
+ * ```
1342
+ *
1343
+ * The server responds to the request with a 402 if there is a problem with the transaction, in this case, the card is expired:
1344
+ *
1345
+ * ```http
1346
+ * HTTP/1.1 402 Payment Required
1347
+ * Date: Tue, 02 Jul 2024 12:56:49 GMT
1348
+ * Content-Type: application/json
1349
+ * Content-Length: 175
1350
+ *
1351
+ * {
1352
+ * "error": {
1353
+ * "code": "expired_card",
1354
+ * "doc_url": "https://example.com/error-codes#expired-card",
1355
+ * "message": "The card has expired. Verify expiration or use a different card.",
1356
+ * }
1357
+ * }
1358
+ * ```
1359
+ *
1360
+ * ## Specifications
1361
+ *
1362
+ * ## Compatibility notes
1363
+ *
1364
+ * This status code is _reserved_ but not defined.
1365
+ * Actual implementations vary in the format and contents of the response.
1366
+ * No browser supports a 402, and an error will be displayed as a generic `4xx` status code.
1367
+ *
1368
+ * ## See also
1369
+ *
1370
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1371
+ * - [HTTP authentication](/en-US/docs/Web/HTTP/Guides/Authentication)
277
1372
  */
278
1373
  PAYMENT_REQUIRED = 402,
279
1374
  /**
280
- * The HTTP **`403 Forbidden`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server understood the request but refused to process it.
1375
+ * The HTTP **`403 Forbidden`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server understood the request but refused to process it.
281
1376
  * This status is similar to [401](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401), except that for **`403 Forbidden`** responses, authenticating or re-authenticating makes no difference.
282
1377
  * The request failure is tied to application logic, such as insufficient permissions to a resource or action.
283
1378
  *
284
1379
  * Clients that receive a `403` response should expect that repeating the request without modification will fail with the same error.
285
1380
  * Server owners may decide to send a [404](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404) response instead of a 403 if acknowledging the existence of a resource to clients with insufficient privileges is not desired.
286
- */
287
- FORBIDDEN = 403,
288
- /**
289
- * The HTTP **`404 Not Found`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server cannot find the requested resource.
1381
+ *
1382
+ * ## Status
1383
+ *
1384
+ * ```http
1385
+ * 403 Forbidden
1386
+ * ```
1387
+ *
1388
+ * ## Examples
1389
+ *
1390
+ * ### Request failed due to insufficient permissions
1391
+ *
1392
+ * The following example request is made to an API for user management.
1393
+ * The request contains an [Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) header using `Bearer` [authentication scheme](/en-US/docs/Web/HTTP/Guides/Authentication#authentication_schemes) containing an access token:
1394
+ *
1395
+ * ```http
1396
+ * DELETE /users/123 HTTP/1.1
1397
+ * Host: example.com
1398
+ * Authorization: Bearer abcd123
1399
+ * ```
1400
+ *
1401
+ * The server has authenticated the request, but the action fails due to insufficient rights and the response body contains a reason for the failure:
1402
+ *
1403
+ * ```http
1404
+ * HTTP/1.1 403 Forbidden
1405
+ * Date: Tue, 02 Jul 2024 12:56:49 GMT
1406
+ * Content-Type: application/json
1407
+ * Content-Length: 88
1408
+ *
1409
+ * {
1410
+ * "error": "InsufficientPermissions",
1411
+ * "message": "Deleting users requires the 'admin' role."
1412
+ * }
1413
+ * ```
1414
+ *
1415
+ * ## Specifications
1416
+ *
1417
+ * ## See also
1418
+ *
1419
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1420
+ * - [401](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401)
1421
+ * - [HTTP Status Code Definitions](https://httpwg.org/specs/rfc9110.html#status.403)
1422
+ */
1423
+ FORBIDDEN = 403,
1424
+ /**
1425
+ * The HTTP **`404 Not Found`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server cannot find the requested resource.
290
1426
  * Links that lead to a 404 page are often called broken or dead links and can be subject to [link rot](https://en.wikipedia.org/wiki/Link_rot).
291
1427
  *
292
1428
  * A 404 status code only indicates that the resource is missing without indicating if this is temporary or permanent.
@@ -294,18 +1430,114 @@ declare enum HttpStatusCode {
294
1430
  *
295
1431
  * 404 errors on a website can lead to a poor user experience for your visitors, so the number of broken links (internal and external) should be minimized to prevent frustration for readers.
296
1432
  * Common causes of 404 responses are mistyped URLs or pages that are moved or deleted without redirection.
297
- * For more information, see the [Redirections in HTTP](/en-US/docs/Web/HTTP/Redirections) guide.
1433
+ * For more information, see the [Redirections in HTTP](/en-US/docs/Web/HTTP/Guides/Redirections) guide.
1434
+ *
1435
+ * ## Status
1436
+ *
1437
+ * ```http
1438
+ * 404 Not Found
1439
+ * ```
1440
+ *
1441
+ * ## Examples
1442
+ *
1443
+ * ### Page not found
1444
+ *
1445
+ * Fetching a non-existent page may look like the following request:
1446
+ *
1447
+ * ```http
1448
+ * GET /my-deleted-blog-post HTTP/1.1
1449
+ * Host: example.com
1450
+ * ```
1451
+ *
1452
+ * The server returns a response similar to this:
1453
+ *
1454
+ * ```http
1455
+ * HTTP/1.1 404 Not Found
1456
+ * Age: 249970
1457
+ * Cache-Control: max-age=604800
1458
+ * Content-Type: text/html; charset=UTF-8
1459
+ * Date: Fri, 28 Jun 2024 11:40:58 GMT
1460
+ * Expires: Fri, 05 Jul 2024 11:40:58 GMT
1461
+ * Last-Modified: Tue, 25 Jun 2024 14:14:48 GMT
1462
+ * Server: ECAcc (nyd/D13E)
1463
+ * Vary: Accept-Encoding
1464
+ * X-Cache: 404-HIT
1465
+ * Content-Length: 1256
1466
+ *
1467
+ *
1468
+ * ...
1469
+ * ```
1470
+ *
1471
+ * ### Custom error page in Apache
1472
+ *
1473
+ * For the Apache server, you can specify a path to a custom 404 page in a `.htaccess` file.
1474
+ * The example below uses `notfound.html` as a page to show visitors on 404s, although a common approach is to name the file `404.html` or `404.php` (depending on the server-side technology) at the top-level of the server:
1475
+ *
1476
+ * ```apacheconf
1477
+ * ErrorDocument 404 /notfound.html
1478
+ * ```
1479
+ *
1480
+ * > [!NOTE]
1481
+ * > Custom 404 page design is a good thing in moderation.
1482
+ * > Feel free to make your 404 page humorous and human, but don't confuse your visitors as to why they are seeing something unexpected.
1483
+ * >
1484
+ * > For an example of a custom 404 page, see the [KonMari 404 page](https://konmari.com/404).
1485
+ *
1486
+ * ## Specifications
1487
+ *
1488
+ * ## See also
1489
+ *
1490
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1491
+ * - [410](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410)
1492
+ * - [Wikipedia: HTTP 404](https://en.wikipedia.org/wiki/HTTP_404)
298
1493
  */
299
1494
  NOT_FOUND = 404,
300
1495
  /**
301
- * The HTTP **`405 Method Not Allowed`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server knows the request method, but the target resource doesn't support this method.
1496
+ * The HTTP **`405 Method Not Allowed`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server knows the request method, but the target resource doesn't support this method.
302
1497
  * The server **must** generate an [Allow](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Allow) header in a 405 response with a list of methods that the target resource currently supports.
303
1498
  *
304
1499
  * Improper server-side permissions set on files or directories may cause a 405 response when the request would otherwise be expected to succeed.
1500
+ *
1501
+ * ## Status
1502
+ *
1503
+ * ```http
1504
+ * 405 Method Not Allowed
1505
+ * ```
1506
+ *
1507
+ * ## Examples
1508
+ *
1509
+ * ### TRACE method not allowed
1510
+ *
1511
+ * Server owners often disallow the use of the `TRACE` method due to security concerns.
1512
+ * The following example shows a typical response where a server doesn't allow the use of `TRACE`:
1513
+ *
1514
+ * ```http
1515
+ * TRACE / HTTP/1.1
1516
+ * Host: example.com
1517
+ * ```
1518
+ *
1519
+ * ```http
1520
+ * HTTP/1.1 405 Method Not Allowed
1521
+ * Content-Length: 0
1522
+ * Date: Fri, 28 Jun 2024 14:30:31 GMT
1523
+ * Server: ECLF (nyd/D179)
1524
+ * Allow: GET, POST, HEAD
1525
+ * ```
1526
+ *
1527
+ * ## Specifications
1528
+ *
1529
+ * ## See also
1530
+ *
1531
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1532
+ * - [Allow](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Allow)
1533
+ * - [501 Not Implemented](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/501), [510 Not Extended](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/510)
1534
+ * - [HTTP Status Code Definitions](https://httpwg.org/specs/rfc9110.html#status.405)
1535
+ * - [How to Fix 405 Method Not Allowed](https://kinsta.com/blog/405-method-not-allowed-error/)
1536
+ * - [Troubleshooting HTTP 405](https://learn.microsoft.com/en-us/aspnet/web-api/overview/testing-and-debugging/troubleshooting-http-405-errors-after-publishing-web-api-applications)
305
1537
  */
306
1538
  METHOD_NOT_ALLOWED = 405,
307
1539
  /**
308
- * The HTTP **`406 Not Acceptable`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server could not produce a response matching the list of acceptable values defined in the request's [proactive content negotiation](/en-US/docs/Web/HTTP/Content_negotiation#server-driven_content_negotiation) headers and that the server was unwilling to supply a default representation.
1540
+ * The HTTP **`406 Not Acceptable`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server could not produce a response matching the list of acceptable values defined in the request's [proactive content negotiation](/en-US/docs/Web/HTTP/Guides/Content_negotiation#server-driven_content_negotiation) headers and that the server was unwilling to supply a default representation.
309
1541
  *
310
1542
  * Proactive content negotiation headers include:
311
1543
  *
@@ -317,17 +1549,96 @@ declare enum HttpStatusCode {
317
1549
  * In such cases, a [200](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200) response with a default resource that doesn't match the client's list of acceptable content negotiation values may be preferable to sending a 406 response.
318
1550
  *
319
1551
  * If a server returns a 406, the body of the message should contain the list of available representations for the resource, allowing the user to choose, although no standard way for this is defined.
1552
+ *
1553
+ * ## Status
1554
+ *
1555
+ * ```http
1556
+ * 406 Not Acceptable
1557
+ * ```
1558
+ *
1559
+ * ## Examples
1560
+ *
1561
+ * ### Content type not available
1562
+ *
1563
+ * The following request assumes that `www.example.com/docs/doc1` supports sending a document back as `application/rtf`:
1564
+ *
1565
+ * ```http
1566
+ * GET /docs/doc1 HTTP/1.1
1567
+ * Host: example.com
1568
+ * Accept: application/rtf;
1569
+ * ```
1570
+ *
1571
+ * In this example, the server implementation does not fallback to a default content type like `text/html` or `application/json`, but returns a 406 instead:
1572
+ *
1573
+ * ```http
1574
+ * HTTP/1.1 406 Not Acceptable
1575
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
1576
+ * Server: Apache/2.4.1 (Unix)
1577
+ * Content-Type: application/json
1578
+ *
1579
+ * {
1580
+ * "code": "UnsupportedType",
1581
+ * "message": "Only 'text/html' or 'application/json' content types supported.",
1582
+ * }
1583
+ * ```
1584
+ *
1585
+ * ## Specifications
1586
+ *
1587
+ * ## See also
1588
+ *
1589
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1590
+ * - [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)
1591
+ * - [Accept-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding)
1592
+ * - [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language)
1593
+ * - HTTP [content negotiation](/en-US/docs/Web/HTTP/Guides/Content_negotiation)
320
1594
  */
321
1595
  NOT_ACCEPTABLE = 406,
322
1596
  /**
323
- * The HTTP **`407 Proxy Authentication Required`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the request did not succeed because it lacks valid authentication credentials for the [proxy server](https://developer.mozilla.org/en-US/docs/Glossary/proxy_server) that sits between the client and the server with access to the requested resource.
1597
+ * The HTTP **`407 Proxy Authentication Required`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the request did not succeed because it lacks valid authentication credentials for the [proxy server](https://developer.mozilla.org/en-US/docs/Glossary/proxy_server) that sits between the client and the server with access to the requested resource.
324
1598
  *
325
1599
  * This response is sent with a [Proxy-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authenticate) header that contains information on how to correctly authenticate requests.
326
1600
  * The client may repeat the request with a new or replaced [Proxy-Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization) header field.
1601
+ *
1602
+ * ## Status
1603
+ *
1604
+ * ```http
1605
+ * 407 Proxy Authentication Required
1606
+ * ```
1607
+ *
1608
+ * ## Examples
1609
+ *
1610
+ * ### Proxy auth
1611
+ *
1612
+ * A GET request is made to `example.com/admin`:
1613
+ *
1614
+ * ```http
1615
+ * GET /admin HTTP/1.1
1616
+ * Host: example.com
1617
+ * ```
1618
+ *
1619
+ * Along the way, an intermediary lets the client know that clients must be authenticated and provides information about the authentication scheme:
1620
+ *
1621
+ * ```http
1622
+ * HTTP/1.1 407 Proxy Authentication Required
1623
+ * Date: Wed, 21 Oct 2015 07:28:00 GMT
1624
+ * Proxy-Authenticate: Basic realm="Access to internal site"
1625
+ * ```
1626
+ *
1627
+ * ## Specifications
1628
+ *
1629
+ * ## See also
1630
+ *
1631
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1632
+ * - [HTTP authentication](/en-US/docs/Web/HTTP/Guides/Authentication)
1633
+ * - [WWW-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate)
1634
+ * - [Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization)
1635
+ * - [Proxy-Authorization](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization)
1636
+ * - [Proxy-Authenticate](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authenticate)
1637
+ * - [401](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401), [403](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403)
327
1638
  */
328
1639
  PROXY_AUTHENTICATION_REQUIRED = 407,
329
1640
  /**
330
- * The HTTP **`408 Request Timeout`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server would like to shut down this unused connection.
1641
+ * The HTTP **`408 Request Timeout`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server would like to shut down this unused connection.
331
1642
  * A `408` is sent on an idle connection by some servers, _even without any previous request by the client_.
332
1643
  *
333
1644
  * A server should send the [Connection: close](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header field in the response, since `408` implies that the server has decided to close the connection rather than continue waiting.
@@ -336,50 +1647,283 @@ declare enum HttpStatusCode {
336
1647
  *
337
1648
  * > [!NOTE]
338
1649
  * > Some servers will shut down a connection without sending this message.
1650
+ *
1651
+ * ## Status
1652
+ *
1653
+ * ```http
1654
+ * 408 Request Timeout
1655
+ * ```
1656
+ *
1657
+ * ## Examples
1658
+ *
1659
+ * ### Timeout in form submission
1660
+ *
1661
+ * The following example shows what a client may send when an [`
1662
+ * ```
1663
+ *
1664
+ * ## Specifications
1665
+ *
1666
+ * ## See also
1667
+ *
1668
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1669
+ * - [Connection](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection)
1670
+ * - [X-DNS-Prefetch-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control)
339
1671
  */
340
1672
  REQUEST_TIMEOUT = 408,
341
1673
  /**
342
- * The HTTP **`409 Conflict`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates a request conflict with the current state of the target resource.
1674
+ * The HTTP **`409 Conflict`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates a request conflict with the current state of the target resource.
343
1675
  *
344
1676
  * In [WebDAV](https://developer.mozilla.org/en-US/docs/glossary/WebDAV) remote web authoring, 409 conflict responses are errors sent to the client so that a user might be able to resolve a conflict and resubmit the request.
345
1677
  * For example, conflicts occur if a request to create collection `/a/b/c/d/` is made, and `/a/b/c/` does not exist, the request must fail with a 409.
346
1678
  * Additionally, you may get a 409 response when uploading a file that is older than the existing one on the server, resulting in a version control conflict.
347
1679
  *
348
1680
  * In other systems, 409 responses may be used for implementation-specific purposes, such as to indicate that the server has received multiple requests to update the same resource.
1681
+ *
1682
+ * ## Status
1683
+ *
1684
+ * ```http
1685
+ * 409 Conflict
1686
+ * ```
1687
+ *
1688
+ * ## Examples
1689
+ *
1690
+ * ### Concurrent tasks disallowed
1691
+ *
1692
+ * In the following example, we want to kick off an automation process that performs a common task in the system:
1693
+ *
1694
+ * ```http
1695
+ * POST /tasks HTTP/1.1
1696
+ * Host: example.com
1697
+ * Content-Type: application/json
1698
+ *
1699
+ * {
1700
+ * "task": "emailDogOwners",
1701
+ * "template": "pickup"
1702
+ * }
1703
+ * ```
1704
+ *
1705
+ * In this implementation, the server disallows two concurrent jobs from running and returns a 409, providing the client an opportunity to check if they meant to perform the action or run a different task:
1706
+ *
1707
+ * ```http
1708
+ * HTTP/1.1 409 Conflict
1709
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
1710
+ * Server: Apache/2.4.1 (Unix)
1711
+ * Content-Type: application/json
1712
+ *
1713
+ * {
1714
+ * "code": "AutomationConflict",
1715
+ * "task": "emailDogOwners",
1716
+ * "message": "Task locked. Cannot start a new automation since job is already running.",
1717
+ * "runningTaskId": "123"
1718
+ * }
1719
+ * ```
1720
+ *
1721
+ * ## Specifications
1722
+ *
1723
+ * ## See also
1724
+ *
1725
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1726
+ * - [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/PUT)
349
1727
  */
350
1728
  CONFLICT = 409,
351
1729
  /**
352
- * The HTTP **`410 Gone`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the target resource is no longer available at the origin server and that this condition is likely to be permanent.
1730
+ * The HTTP **`410 Gone`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the target resource is no longer available at the origin server and that this condition is likely to be permanent.
353
1731
  * A 410 response is cacheable by default.
354
1732
  *
355
1733
  * Clients should not repeat requests for resources that return a 410 response, and website owners should remove or replace links that return this code.
356
1734
  * If server owners don't know whether this condition is temporary or permanent, a status code should be used instead.
1735
+ *
1736
+ * ## Status
1737
+ *
1738
+ * ```http
1739
+ * 410 Gone
1740
+ * ```
1741
+ *
1742
+ * ## Examples
1743
+ *
1744
+ * ### Requesting an outdated resource
1745
+ *
1746
+ * The following `GET` request is for a page with promotional content that is no longer valid:
1747
+ *
1748
+ * ```http
1749
+ * GET /promotions/summer-2023 HTTP/1.1
1750
+ * Host: example.com
1751
+ * ```
1752
+ *
1753
+ * ```http
1754
+ * HTTP/1.1 410 Gone
1755
+ * Content-Type: text/html
1756
+ * Content-Length: 212
1757
+ *
1758
+ *
1759
+ * ```
1760
+ *
1761
+ * ## Specifications
1762
+ *
1763
+ * ## See also
1764
+ *
1765
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1766
+ * -
1767
+ * - [410 gone](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#410)
357
1768
  */
358
1769
  GONE = 410,
359
1770
  /**
360
- * The HTTP **`411 Length Required`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server refused to accept the request without a defined [Content-Length](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header.
1771
+ * The HTTP **`411 Length Required`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server refused to accept the request without a defined [Content-Length](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header.
361
1772
  *
362
1773
  * > [!NOTE]
363
1774
  * > When sending data in a series of chunks, the `Content-Length` header is omitted, and at the beginning of each chunk, the length of the current chunk needs to be included in hexadecimal format.
364
1775
  * > See [Transfer-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding) for more details.
1776
+ *
1777
+ * ## Status
1778
+ *
1779
+ * ```http
1780
+ * 411 Length Required
1781
+ * ```
1782
+ *
1783
+ * ## Examples
1784
+ *
1785
+ * ### Chunked POST request
1786
+ *
1787
+ * The following request is sent chunked, which is the default method of sending data in some cases, such as when [writing to streams](https://nodejs.org/api/http.html#requestwritechunk-encoding-callback):
1788
+ *
1789
+ * ```http
1790
+ * POST /translate/de HTTP/1.1
1791
+ * Host: api.example.com
1792
+ * Content-Type: application/json
1793
+ * Transfer-encoding: chunked
1794
+ *
1795
+ * 2C
1796
+ * {"text": "Hurry up, Ayşe is hungry!"}
1797
+ * 0
1798
+ * ```
1799
+ *
1800
+ * In this case, the server is expecting a request in one part with a [Content-Length](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header and returns a 411 response:
1801
+ *
1802
+ * ```http
1803
+ * HTTP/1.1 411 Length Required
1804
+ * Content-Type: application/json
1805
+ * Content-Length: 110
1806
+ *
1807
+ * {
1808
+ * "message": "Requests must have a content length header.",
1809
+ * "documentation": "http://api/example.com/docs/errors",
1810
+ * }
1811
+ * ```
1812
+ *
1813
+ * ## Specifications
1814
+ *
1815
+ * ## See also
1816
+ *
1817
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1818
+ * - [Content-Length](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length)
1819
+ * - [Transfer-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding)
365
1820
  */
366
1821
  LENGTH_REQUIRED = 411,
367
1822
  /**
368
- * The HTTP **`412 Precondition Failed`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that access to the target resource was denied.
369
- * This happens with [conditional requests](/en-US/docs/Web/HTTP/Conditional_requests) on methods other than [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) or [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/HEAD) when the condition defined by the [If-Unmodified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since) or [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match) headers is not fulfilled.
1823
+ * The HTTP **`412 Precondition Failed`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that access to the target resource was denied.
1824
+ * This happens with [conditional requests](/en-US/docs/Web/HTTP/Guides/Conditional_requests) on methods other than [GET](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/GET) or [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/HEAD) when the condition defined by the [If-Unmodified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since) or [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match) headers is not fulfilled.
370
1825
  * In that case, the request (usually an upload or a modification of a resource) cannot be made and this error response is sent back.
1826
+ *
1827
+ * ## Status
1828
+ *
1829
+ * ```http
1830
+ * 412 Precondition Failed
1831
+ * ```
1832
+ *
1833
+ * ## Examples
1834
+ *
1835
+ * ### Precondition failed
1836
+ *
1837
+ * ```http
1838
+ * ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"
1839
+ * ETag: W/"0815"
1840
+ * ```
1841
+ *
1842
+ * ### Avoiding mid-air collisions
1843
+ *
1844
+ * With the help of the `ETag` and the [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match) headers, you can prevent conflicts or mid-air collisions.
1845
+ * For example, when editing some wiki pages, content is hashed and put into an `ETag` in successful responses:
1846
+ *
1847
+ * ```http
1848
+ * ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"
1849
+ * ```
1850
+ *
1851
+ * When saving changes to a wiki page (posting data), the [POST](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/POST) request will contain the [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match) header containing the `ETag` values that the client stored from the last edit to check freshness of the resource on the server:
1852
+ *
1853
+ * ```http
1854
+ * If-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"
1855
+ * ```
1856
+ *
1857
+ * If the hashes don't match, the document has been edited in-between and a `412 Precondition Failed` error is thrown.
1858
+ *
1859
+ * ## Specifications
1860
+ *
1861
+ * ## See also
1862
+ *
1863
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1864
+ * - [Conditional requests](/en-US/docs/Web/HTTP/Guides/Conditional_requests)
1865
+ * - [304](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304)
1866
+ * - [If-Unmodified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since), [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match)
1867
+ * - [428](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/428)
371
1868
  */
372
1869
  PRECONDITION_FAILED = 412,
373
1870
  /**
374
- * The HTTP **`413 Content Too Large`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the request entity was larger than limits defined by server.
1871
+ * The HTTP **`413 Content Too Large`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the request entity was larger than limits defined by server.
375
1872
  * The server might close the connection or return a [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header field.
376
1873
  *
377
1874
  * Prior to [9110](https://developer.mozilla.org/en-US/docs/rfc/9110) the response phrase for the status was **`Payload Too Large`**.
378
1875
  * This message is still widely used.
1876
+ *
1877
+ * ## Status
1878
+ *
1879
+ * ```http
1880
+ * 413 Content Too Large
1881
+ * ```
1882
+ *
1883
+ * ## Examples
1884
+ *
1885
+ * ### File upload limit exceeded
1886
+ *
1887
+ * The following example shows what the client may send when an [`<input type="file">`](/en-US/docs/Web/HTML/Reference/Elements/input/file) element includes an image on form submission with `method="post"`:
1888
+ *
1889
+ * ```http
1890
+ * POST /upload HTTP/1.1
1891
+ * Host: example.com
1892
+ * Content-Type: multipart/form-data; boundary=----Boundary1234
1893
+ * Content-Length: 4012345
1894
+ *
1895
+ * ------Boundary1234
1896
+ * Content-Disposition: form-data; name="file"; filename="myImage.jpg"
1897
+ * Content-Type: image/jpeg
1898
+ *
1899
+ * \xFF\xD8\xFF\xE0\x00...(binary data)
1900
+ * ------Boundary1234--
1901
+ * ```
1902
+ *
1903
+ * The server may reject the upload if there is a restriction on the maximum size of files it will process, and the response body includes a `message` with some context:
1904
+ *
1905
+ * ```http
1906
+ * HTTP/1.1 413 Content Too Large
1907
+ * Content-Type: application/json
1908
+ * Content-Length: 97
1909
+ *
1910
+ * {
1911
+ * "error": "Upload failed",
1912
+ * "message": "Maximum allowed upload size is 4MB",
1913
+ * }
1914
+ * ```
1915
+ *
1916
+ * ## Specifications
1917
+ *
1918
+ * ## See also
1919
+ *
1920
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1921
+ * - [Connection](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection)
1922
+ * - [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After)
379
1923
  */
380
1924
  CONTENT_TOO_LARGE = 413,
381
1925
  /**
382
- * The HTTP **`414 URI Too Long`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that a URI requested by the client was longer than the server is willing to interpret.
1926
+ * The HTTP **`414 URI Too Long`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that a URI requested by the client was longer than the server is willing to interpret.
383
1927
  *
384
1928
  * There are a few rare conditions when this error might occur:
385
1929
  *
@@ -388,29 +1932,201 @@ declare enum HttpStatusCode {
388
1932
  * - the server is under attack by a client attempting to exploit potential security holes.
389
1933
  *
390
1934
  * Some systems implement `414 URI Too Long` as `414 Request-URI Too Large`.
1935
+ *
1936
+ * ## Status
1937
+ *
1938
+ * ```http
1939
+ * 414 URI Too Long
1940
+ * ```
1941
+ *
1942
+ * ## Examples
1943
+ *
1944
+ * ### Form submission using GET
1945
+ *
1946
+ * In the following example, an HTML [`
1947
+ * ```
1948
+ *
1949
+ * ## Specifications
1950
+ *
1951
+ * ## See also
1952
+ *
1953
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
1954
+ * - [URI](https://developer.mozilla.org/en-US/docs/Glossary/URI)
391
1955
  */
392
1956
  URI_TOO_LONG = 414,
393
1957
  /**
394
- * The HTTP **`415 Unsupported Media Type`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server refused to accept the request because the message [content](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_Content) format is not supported.
1958
+ * The HTTP **`415 Unsupported Media Type`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server refused to accept the request because the message [content](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_Content) format is not supported.
395
1959
  *
396
1960
  * The format problem might be due to the request's indicated [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) or [Content-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding), or as a result of processing the request message content.
397
1961
  * Some servers may be strict about the expected `Content-Type` of requests.
398
1962
  * For example, sending `UTF8` instead of `UTF-8` to specify the [UTF-8](https://developer.mozilla.org/en-US/docs/glossary/UTF-8) charset may cause the server to consider the media type invalid.
1963
+ *
1964
+ * ## Status
1965
+ *
1966
+ * ```http
1967
+ * 415 Unsupported Media Type
1968
+ * ```
1969
+ *
1970
+ * ## Examples
1971
+ *
1972
+ * ### Missing content type
1973
+ *
1974
+ * In the following example, the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) header is missing entirely:
1975
+ *
1976
+ * ```http
1977
+ * POST /comments HTTP/1.1
1978
+ * Host: example.com
1979
+ * Content-Length: 23
1980
+ *
1981
+ * {
1982
+ * "user": "belgin",
1983
+ * "comment": "LGTM!"
1984
+ * }
1985
+ * ```
1986
+ *
1987
+ * If the server implementation expects at least a MIME type `Content-Type: application/json;` for the request at that endpoint, it may send the following response:
1988
+ *
1989
+ * ```http
1990
+ * HTTP/1.1 415 Unsupported Media Type
1991
+ * Date: Fri, 28 Jun 2024 12:00:00 GMT
1992
+ * Server: Apache/2.4.41 (Ubuntu)
1993
+ * Accept-Post: application/json; charset=UTF-8
1994
+ * Content-Length: 0
1995
+ * ```
1996
+ *
1997
+ * ### Invalid content type
1998
+ *
1999
+ * In the following example, the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) header is incorrectly set to URL-encoded form data when the [content](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_Content) is in the request body instead:
2000
+ *
2001
+ * ```http
2002
+ * POST /comments HTTP/1.1
2003
+ * Host: example.com
2004
+ * Content-Length: 23
2005
+ * Content-Type: application/x-www-form-urlencoded
2006
+ *
2007
+ * {
2008
+ * "user": "belgin",
2009
+ * "comment": "LGTM!"
2010
+ * }
2011
+ * ```
2012
+ *
2013
+ * In this case, the server responds with a 415, with the required content type for the request in the [Accept-Post](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Post) header:
2014
+ *
2015
+ * ```http
2016
+ * HTTP/1.1 415 Unsupported Media Type
2017
+ * Date: Fri, 28 Jun 2024 12:00:00 GMT
2018
+ * Server: Apache/2.4.41 (Ubuntu)
2019
+ * Accept-Post: application/json; charset=UTF-8
2020
+ * Content-Length: 0
2021
+ * ```
2022
+ *
2023
+ * ## Specifications
2024
+ *
2025
+ * ## See also
2026
+ *
2027
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2028
+ * - [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)
2029
+ * - [Content-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding)
2030
+ * - [Accept-Post](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Post)
399
2031
  */
400
2032
  UNSUPPORTED_MEDIA_TYPE = 415,
401
2033
  /**
402
- * The HTTP **`416 Range Not Satisfiable`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that a server could not serve the requested ranges.
403
- * The most likely reason for this response is that the document doesn't contain such [ranges](/en-US/docs/Web/HTTP/Range_requests), or that the [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) header value, though syntactically correct, doesn't make sense.
2034
+ * The HTTP **`416 Range Not Satisfiable`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that a server could not serve the requested ranges.
2035
+ * The most likely reason for this response is that the document doesn't contain such [ranges](/en-US/docs/Web/HTTP/Guides/Range_requests), or that the [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) header value, though syntactically correct, doesn't make sense.
404
2036
  *
405
2037
  * The `416` response message should contain a [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) indicating an unsatisfied range (that is a `'*'`) followed by a `'/'` and the current length of the resource, e.g., `Content-Range: bytes * /12777`
406
2038
  *
407
2039
  * When encountering this error, browsers typically either abort the operation (for example, a download will be considered non-resumable) or request the whole document again without ranges.
2040
+ *
2041
+ * ## Status
2042
+ *
2043
+ * ```http
2044
+ * 416 Range Not Satisfiable
2045
+ * ```
2046
+ *
2047
+ * ## Examples
2048
+ *
2049
+ * ### Malformed range request
2050
+ *
2051
+ * The following request asks for a range of 1000-1999 bytes from a text file.
2052
+ * The first position unit (1000) is larger than the actual resource on the server (800 bytes):
2053
+ *
2054
+ * ```http
2055
+ * GET /files/prose.txt HTTP/1.1
2056
+ * Host: example.com
2057
+ * Range: bytes=1000-1999
2058
+ * ```
2059
+ *
2060
+ * The server supports range requests and sends back the current length of the selected representation in the [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header:
2061
+ *
2062
+ * ```http
2063
+ * HTTP/1.1 416 Range Not Satisfiable
2064
+ * Date: Fri, 28 Jun 2024 11:40:58 GMT
2065
+ * Content-Range: bytes * /800
2066
+ * ```
2067
+ *
2068
+ * ## Specifications
2069
+ *
2070
+ * ## See also
2071
+ *
2072
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2073
+ * - [206 Partial Content](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206)
2074
+ * - [HTTP range requests](/en-US/docs/Web/HTTP/Guides/Range_requests)
2075
+ * - [Content-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
2076
+ * - [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range)
408
2077
  */
409
2078
  RANGE_NOT_SATISFIABLE = 416,
410
2079
  /**
411
- * The HTTP **`417 Expectation Failed`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the expectation given in the request's [Expect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect) header could not be met.
2080
+ * The HTTP **`417 Expectation Failed`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the expectation given in the request's [Expect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect) header could not be met.
412
2081
  * After receiving a 417 response, a client should repeat the request without an `Expect` request header, including the file in the request body without waiting for a [100](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100) response.
413
2082
  * See the [Expect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect) header documentation for more details.
2083
+ *
2084
+ * ## Status
2085
+ *
2086
+ * ```http
2087
+ * 417 Expectation Failed
2088
+ * ```
2089
+ *
2090
+ * ## Examples
2091
+ *
2092
+ * ### Expectations unsupported
2093
+ *
2094
+ * The following PUT request sends information about an intended file upload to a server.
2095
+ * The client uses an `Expect: 100-continue` header and no request body to avoid sending data over the network that may result in an error such as [405](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405), [401](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401), or [403](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403) response:
2096
+ *
2097
+ * ```http
2098
+ * PUT /videos HTTP/1.1
2099
+ * Host: uploads.example.com
2100
+ * Content-Type: video/h264
2101
+ * Content-Length: 1234567890987
2102
+ * Expect: 100-continue
2103
+ * ```
2104
+ *
2105
+ * In this example server implementation, expectations are not supported and the presence of an `Expect` header with any value results in 417 responses:
2106
+ *
2107
+ * ```http
2108
+ * HTTP/1.1 417 Expectation Failed
2109
+ * Date: Fri, 28 Jun 2024 11:40:58 GMT
2110
+ * ```
2111
+ *
2112
+ * The client responds by making a request without expectations and with the [content](https://developer.mozilla.org/en-US/docs/Glossary/HTTP_Content) in the request body:
2113
+ *
2114
+ * ```http
2115
+ * PUT /videos HTTP/1.1
2116
+ * Host: uploads.example.com
2117
+ * Content-Type: video/h264
2118
+ * Content-Length: 1234567890987
2119
+ *
2120
+ * […]
2121
+ * ```
2122
+ *
2123
+ * ## Specifications
2124
+ *
2125
+ * ## See also
2126
+ *
2127
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2128
+ * - [100 Continue](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100)
2129
+ * - [Expect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect)
414
2130
  */
415
2131
  EXPECTATION_FAILED = 417,
416
2132
  /**
@@ -419,70 +2135,338 @@ declare enum HttpStatusCode {
419
2135
  * This error is a reference to Hyper Text Coffee Pot Control Protocol defined in April Fools' jokes in 1998 and 2014.
420
2136
  *
421
2137
  * Some websites use this response for requests they do not wish to handle, such as automated queries.
2138
+ *
2139
+ * ## Status
2140
+ *
2141
+ * ```http
2142
+ * 418 I'm a teapot
2143
+ * ```
2144
+ *
2145
+ * ## Specifications
2146
+ *
2147
+ * ## See also
2148
+ *
2149
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2150
+ * - [Wikipedia: Hyper Text Coffee Pot Control Protocol](https://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol)
422
2151
  */
423
2152
  I_M_A_TEAPOT = 418,
424
2153
  /**
425
- * The HTTP **`421 Misdirected Request`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the request was directed to a server that is not able to produce a response.
426
- * This can be sent by a server that is not configured to produce responses for the combination of [scheme](/en-US/docs/Web/URI/Schemes) and [authority](/en-US/docs/Web/URI/Authority) that are included in the request URI.
2154
+ * The HTTP **`421 Misdirected Request`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the request was directed to a server that is not able to produce a response.
2155
+ * This can be sent by a server that is not configured to produce responses for the combination of [scheme](/en-US/docs/Web/URI/Reference/Schemes) and [authority](/en-US/docs/Web/URI/Reference/Authority) that are included in the request URI.
427
2156
  *
428
2157
  * Clients may retry the request over a different connection.
2158
+ *
2159
+ * ## Status
2160
+ *
2161
+ * ```http
2162
+ * 421 Misdirected Request
2163
+ * ```
2164
+ *
2165
+ * ## Examples
2166
+ *
2167
+ * ### Apache SNI error
2168
+ *
2169
+ * Given the following request:
2170
+ *
2171
+ * ```http
2172
+ * GET / HTTP/1.1
2173
+ * Host: abc.example.com
2174
+ * ```
2175
+ *
2176
+ * In cases such as a wildcard certificate (`*.example.com`) and a connection is reused for multiple domains (`abc.example.com`, `def.example.com`), the server may respond with a 421:
2177
+ *
2178
+ * ```http
2179
+ * HTTP/1.1 421 Misdirected Request
2180
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
2181
+ * Server: Apache/2.4.1 (Unix)
2182
+ * ```
2183
+ *
2184
+ * ## Specifications
2185
+ *
2186
+ * ## See also
2187
+ *
2188
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2189
+ * - [Multiple hosts and misdirected requests](https://httpd.apache.org/docs/2.4/mod/mod_http2.html#misdirected) Apache Server documentation
2190
+ * - [TLS 1.3](/en-US/docs/Web/Security/Transport_Layer_Security#tls_1.3)
2191
+ * - [Server Name Indication (SNI)](https://en.wikipedia.org/wiki/Server_Name_Indication)
2192
+ * - [Transport Layer Security (TLS) configuration](/en-US/docs/Web/Security/Practical_implementation_guides/TLS)
429
2193
  */
430
2194
  MISDIRECTED_REQUEST = 421,
431
2195
  /**
432
- * The HTTP **`422 Unprocessable Content`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server understood the content type of the request content, and the syntax of the request content was correct, but it was unable to process the contained instructions.
2196
+ * The HTTP **`422 Unprocessable Content`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server understood the content type of the request content, and the syntax of the request content was correct, but it was unable to process the contained instructions.
433
2197
  *
434
2198
  * Clients that receive a `422` response should expect that repeating the request without modification will fail with the same error.
2199
+ *
2200
+ * ## Status
2201
+ *
2202
+ * ```http
2203
+ * 422 Unprocessable Content
2204
+ * ```
2205
+ *
2206
+ * ## Examples
2207
+ *
2208
+ * ### SHA validation failure
2209
+ *
2210
+ * The following example makes a request to update file contents ([based on GitHub's API](https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents)).
2211
+ * The `content` field is [Base64](https://developer.mozilla.org/en-US/docs/glossary/Base64) encoded and uses `\n` line feeds every 60 characters, with one terminating the string:
2212
+ *
2213
+ * ```http
2214
+ * PUT /repos/mdn/content/contents/README.md HTTP/1.1
2215
+ * Host: api.example.com
2216
+ * Accept: application/vnd.github+json
2217
+ * Authorization: Bearer abcd123
2218
+ * Content-Type: application/json
2219
+ * Content-Length: 165
2220
+ *
2221
+ * {
2222
+ * "message": "My commit",
2223
+ * "content": "WW9zaGkgd2FzIHRoZXJlLCBzbyB3ZXJlIEF5c2UsIGFuZCBCZWxnaW4uIEl0\nIHdhcyBncmVhdCE=\n",
2224
+ * "sha": "80e73970fdee49dbdbac27c1f565d1eb1975d519"
2225
+ * }
2226
+ * ```
2227
+ *
2228
+ * In this implementation, the server expects strictly [4648](https://developer.mozilla.org/en-US/docs/rfc/4648)-compliant Base64 encoded content (using [strict encoding methods](https://ruby-doc.org/3.3.2/stdlibs/base64/Base64.html#method-i-strict_encode64)).
2229
+ * A `422` Unprocessable Content response is returned and the `message` field provides context about the validation error:
2230
+ *
2231
+ * ```http
2232
+ * HTTP/1.1 422 Unprocessable Content
2233
+ * Date: Fri, 28 Jun 2024 12:00:00 GMT
2234
+ * Content-Type: application/json; charset=utf-8
2235
+ * Content-Length: 187
2236
+ *
2237
+ * {
2238
+ * "message": "content is not valid Base64",
2239
+ * "documentation_url": "https://docs.example.com/en/rest/repos/contents"
2240
+ * }
2241
+ * ```
2242
+ *
2243
+ * ## Specifications
2244
+ *
2245
+ * ## See also
2246
+ *
2247
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
435
2248
  */
436
2249
  UNPROCESSABLE_CONTENT = 422,
437
2250
  /**
438
- * The HTTP **`423 Locked`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that a resource is _locked_, meaning it can't be accessed.
2251
+ * The HTTP **`423 Locked`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that a resource is _locked_, meaning it can't be accessed.
439
2252
  * Its response body should contain information in [WebDAV](https://developer.mozilla.org/en-US/docs/glossary/WebDAV)'s XML format.
440
2253
  *
441
2254
  * > [!NOTE]
442
2255
  * > The ability to _lock_ a resource to prevent conflicts is specific to some [WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV) servers.
443
2256
  * > Browsers accessing web pages will never encounter this status code; in the erroneous cases it happens, they will handle it as a generic status code.
2257
+ *
2258
+ * ## Status
2259
+ *
2260
+ * ```http
2261
+ * 423 Locked
2262
+ * ```
2263
+ *
2264
+ * ## Examples
2265
+ *
2266
+ * ### WebDAV 423 Locked response
2267
+ *
2268
+ * ```http
2269
+ * HTTP/1.1 423 Locked
2270
+ * Content-Type: application/xml; charset="utf-8"
2271
+ * Content-Length: xxxx
2272
+ *
2273
+ *
2274
+ * ```
2275
+ *
2276
+ * ## Specifications
2277
+ *
2278
+ * ## See also
2279
+ *
2280
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
444
2281
  */
445
2282
  LOCKED = 423,
446
2283
  /**
447
- * The HTTP **`424 Failed Dependency`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the method could not be performed on the resource because the requested action depended on another action, and that action failed.
2284
+ * The HTTP **`424 Failed Dependency`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the method could not be performed on the resource because the requested action depended on another action, and that action failed.
448
2285
  *
449
2286
  * Regular web servers typically do not return this status code, but some protocols like [WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV) can return it.
450
2287
  * For example, in [WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV), if a `PROPPATCH` request was issued, and one command fails then automatically every other command will also fail with `424 Failed Dependency`.
2288
+ *
2289
+ * ## Status
2290
+ *
2291
+ * ```http
2292
+ * 424 Failed Dependency
2293
+ * ```
2294
+ *
2295
+ * ## Specifications
2296
+ *
2297
+ * ## See also
2298
+ *
2299
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2300
+ * - [403](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403) (Forbidden)
2301
+ * - [501 Not Implemented](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/501), [510 Not Extended](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/510)
451
2302
  */
452
2303
  FAILED_DEPENDENCY = 424,
453
2304
  /**
454
- * The HTTP **`425 Too Early`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server was unwilling to risk processing a request that might be replayed to avoid potential replay attacks.
2305
+ * The HTTP **`425 Too Early`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server was unwilling to risk processing a request that might be replayed to avoid potential replay attacks.
455
2306
  *
456
2307
  * If a client has interacted with a server recently, early data (also known as zero round-trip time [(0-RTT) data](/en-US/docs/Web/Security/Transport_Layer_Security#tls_1.3)) allows the client to send data to a server in the first round trip of a connection, without waiting for the TLS [handshake](/en-US/docs/Glossary/TCP_handshake) to complete.
457
2308
  * A client that sends a request in early data does not need to include the `Early-Data` header.
458
2309
  * See [Early-Data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Early-Data) for more information.
2310
+ *
2311
+ * ## Status
2312
+ *
2313
+ * ```http
2314
+ * 425 Too Early
2315
+ * ```
2316
+ *
2317
+ * ## Specifications
2318
+ *
2319
+ * ## Browser compatibility
2320
+ *
2321
+ * ## See also
2322
+ *
2323
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2324
+ * - [TLS 1.3](/en-US/docs/Web/Security/Transport_Layer_Security#tls_1.3)
2325
+ * - [Early-Data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Early-Data)
459
2326
  */
460
2327
  TOO_EARLY = 425,
461
2328
  /**
462
- * The HTTP **`426 Upgrade Required`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server refused to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.
2329
+ * The HTTP **`426 Upgrade Required`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server refused to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol.
463
2330
  *
464
2331
  * The server sends an [Upgrade](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade) header with this response to indicate the required protocol(s).
2332
+ *
2333
+ * ## Status
2334
+ *
2335
+ * ```http
2336
+ * 426 Upgrade Required
2337
+ * ```
2338
+ *
2339
+ * ## Examples
2340
+ *
2341
+ * ### Upgrade required from HTTP/1.1
2342
+ *
2343
+ * Given a GET request to a system:
2344
+ *
2345
+ * ```http
2346
+ * GET /resources HTTP/1.1
2347
+ * Host: example.com
2348
+ * ```
2349
+ *
2350
+ * The origin server expects that requests must be made in [HTTP/3](/en-US/docs/Glossary/HTTP_3):
2351
+ *
2352
+ * ```http
2353
+ * HTTP/1.1 426 Upgrade Required
2354
+ * Upgrade: HTTP/3.0
2355
+ * Connection: Upgrade
2356
+ * Content-Length: 53
2357
+ * Content-Type: text/plain
2358
+ *
2359
+ * This service requires use of the HTTP/3.0 protocol.
2360
+ * ```
2361
+ *
2362
+ * ## Specifications
2363
+ *
2364
+ * ## See also
2365
+ *
2366
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2367
+ * - [Upgrade](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade)
2368
+ * - [101 Switching Protocols](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/101)
465
2369
  */
466
2370
  UPGRADE_REQUIRED = 426,
467
2371
  /**
468
- * The HTTP **`428 Precondition Required`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server requires the request to be [conditional](/en-US/docs/Web/HTTP/Conditional_requests).
2372
+ * The HTTP **`428 Precondition Required`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server requires the request to be [conditional](/en-US/docs/Web/HTTP/Guides/Conditional_requests).
469
2373
  *
470
2374
  * Typically, a 428 response means that a required precondition header such as [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match) **is missing**.
471
2375
  * When a precondition header does **not match** the server-side state, the response should be [412 Precondition Failed](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412).
2376
+ *
2377
+ * ## Status
2378
+ *
2379
+ * ```http
2380
+ * 428 Precondition Required
2381
+ * ```
2382
+ *
2383
+ * ## Examples
2384
+ *
2385
+ * ### Missing precondition in request
2386
+ *
2387
+ * A client has fetched a resource `my-document` from the server, updated it locally, and then tries to send the updated document back to the server:
2388
+ *
2389
+ * ```http
2390
+ * PUT /docs/my-document HTTP/1.1
2391
+ * Host: example.com
2392
+ * Content-Type: application/json
2393
+ *
2394
+ * {
2395
+ * […]
2396
+ * ```
2397
+ *
2398
+ * The server implementation requires that all [PUT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Method/PUT) requests for the specific path or type of documents must be conditional and sends a 428 response:
2399
+ *
2400
+ * ```http
2401
+ * HTTP/1.1 428 Precondition Required
2402
+ * Date: Wed, 26 Jun 2024 12:00:00 GMT
2403
+ * Server: Apache/2.4.1 (Unix)
2404
+ * Content-Type: application/json
2405
+ *
2406
+ * {
2407
+ * "code": "MissingPrecondition",
2408
+ * "message": "Updating documents requires a precondition header.",
2409
+ * }
2410
+ * ```
2411
+ *
2412
+ * ## Specifications
2413
+ *
2414
+ * ## See also
2415
+ *
2416
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2417
+ * - [HTTP conditional requests](/en-US/docs/Web/HTTP/Guides/Conditional_requests)
2418
+ * - Conditional headers: [If-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match), [If-None-Match](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match), [If-Modified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since), [If-Unmodified-Since](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since), [If-Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Range)
2419
+ * -
472
2420
  */
473
2421
  PRECONDITION_REQUIRED = 428,
474
2422
  /**
475
- * The HTTP **`429 Too Many Requests`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates the client has sent too many requests in a given amount of time.
2423
+ * The HTTP **`429 Too Many Requests`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates the client has sent too many requests in a given amount of time.
476
2424
  * This mechanism of asking the client to slow down the rate of requests is commonly called "[rate limiting](https://developer.mozilla.org/en-US/docs/glossary/rate_limit)".
477
2425
  *
478
2426
  * A [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header may be included to this response to indicate how long a client should wait before making the request again.
479
2427
  *
480
2428
  * Implementations of rate limiting vary; restrictions may be server-wide or per resource.
481
2429
  * Typically, rate-limiting restrictions are based on a client's IP but can be specific to users or authorized applications if requests are authenticated or contain a [cookie](https://developer.mozilla.org/en-US/docs/Glossary/cookie).
2430
+ *
2431
+ * ## Status
2432
+ *
2433
+ * ```http
2434
+ * 429 Too Many Requests
2435
+ * ```
2436
+ *
2437
+ * ## Examples
2438
+ *
2439
+ * ### Response containing Retry-After header
2440
+ *
2441
+ * The following request is being sent repeatedly in a loop by a client that is misconfigured:
2442
+ *
2443
+ * ```http
2444
+ * GET /reports/mdn HTTP/1.1
2445
+ * Host: example.com
2446
+ * ```
2447
+ *
2448
+ * In this example, server-wide rate limiting is active when a client exceeds a set threshold of requests per minute.
2449
+ * A 429 response is returned with a [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header that indicates that requests will be allowed for this client again in 60 minutes:
2450
+ *
2451
+ * ```http
2452
+ * HTTP/1.1 429 Too Many Requests
2453
+ * Content-Type: text/html
2454
+ * Retry-After: 3600
2455
+ *
2456
+ *
2457
+ * ```
2458
+ *
2459
+ * ## Specifications
2460
+ *
2461
+ * ## See also
2462
+ *
2463
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2464
+ * - [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After)
2465
+ * - Python solution: [How to avoid HTTP error 429 python](https://stackoverflow.com/questions/22786068/how-to-avoid-http-error-429-too-many-requests-python)
482
2466
  */
483
2467
  TOO_MANY_REQUESTS = 429,
484
2468
  /**
485
- * The HTTP **`431 Request Header Fields Too Large`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the server refuses to process the request because the request's [HTTP headers](/en-US/docs/Web/HTTP/Headers) are too long.
2469
+ * The HTTP **`431 Request Header Fields Too Large`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the server refuses to process the request because the request's [HTTP headers](/en-US/docs/Web/HTTP/Reference/Headers) are too long.
486
2470
  * The request may be resubmitted after reducing the size of the request headers.
487
2471
  *
488
2472
  * 431 can be used when the total size of request headers is too large or when a single header field is too large.
@@ -492,24 +2476,124 @@ declare enum HttpStatusCode {
492
2476
  * Servers will often produce this status if:
493
2477
  *
494
2478
  * - The [Referer](https://developer.mozilla.org/en-US/docs/httpheader/Referer) URL is too long
495
- * - There are too many [Cookies](/en-US/docs/Web/HTTP/Cookies) sent in the request
2479
+ * - There are too many [Cookies](/en-US/docs/Web/HTTP/Guides/Cookies) sent in the request
2480
+ *
2481
+ * ## Status
2482
+ *
2483
+ * ```http
2484
+ * 431 Request Header Fields Too Large
2485
+ * ```
2486
+ *
2487
+ * ## Examples
2488
+ *
2489
+ * ### Header field too large
2490
+ *
2491
+ * In the following example, the [Cookie](https://developer.mozilla.org/en-US/docs/httpheader/Cookie) header is too large in the request:
2492
+ *
2493
+ * ```http
2494
+ * GET /doc HTTP/1.1
2495
+ * Host: example.com
2496
+ * Cookie: cookie1=value1; cookie2=value2; cookie3=[…]
2497
+ * ```
2498
+ *
2499
+ * The server responds with an message indicating which header was problematic:
2500
+ *
2501
+ * ```http
2502
+ * HTTP/1.1 431 Request Header Fields Too Large
2503
+ * Content-Type: text/html
2504
+ *
2505
+ *
2506
+ * ```
2507
+ *
2508
+ * ## Specifications
2509
+ *
2510
+ * ## See also
2511
+ *
2512
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2513
+ * - [414 URI Too Long](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/414)
2514
+ * - [Request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
496
2515
  */
497
2516
  REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
498
2517
  /**
499
- * The HTTP **`451 Unavailable For Legal Reasons`** [client error response](/en-US/docs/Web/HTTP/Status#client_error_responses) status code indicates that the user requested a resource that is not available due to legal reasons, such as a web page for which a legal action has been issued.
2518
+ * The HTTP **`451 Unavailable For Legal Reasons`** [client error response](/en-US/docs/Web/HTTP/Reference/Status#client_error_responses) status code indicates that the user requested a resource that is not available due to legal reasons, such as a web page for which a legal action has been issued.
2519
+ *
2520
+ * ## Status
2521
+ *
2522
+ * ```http
2523
+ * 451 Unavailable For Legal Reasons
2524
+ * ```
2525
+ *
2526
+ * ## Examples
2527
+ *
2528
+ * ### Response with Link header
2529
+ *
2530
+ * This example response is taken from the IETF RFC (see below) and contains a reference to [Monty Python's Life of Brian](https://en.wikipedia.org/wiki/Monty_Python's_Life_of_Brian).
2531
+ *
2532
+ * > [!NOTE]
2533
+ * > The [Link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) header might also contain a `rel="blocked-by"` relation identifying the entity implementing the blockage, not any other entity mandating it.
2534
+ *
2535
+ * Any attempt to identify the entity ultimately responsible for the resource being unavailable belongs in the response body, not in the `rel="blocked-by"` link. This includes the name of the person or organization that made a legal demand resulting in the content's removal.
2536
+ *
2537
+ * ```http
2538
+ * HTTP/1.1 451 Unavailable For Legal Reasons
2539
+ * Link:
2540
+ * ```
2541
+ *
2542
+ * ## Specifications
2543
+ *
2544
+ * ## See also
2545
+ *
2546
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2547
+ * - [Wikipedia: HTTP 451](https://en.wikipedia.org/wiki/HTTP_451)
2548
+ * - [Wikipedia: Fahrenheit 451](https://en.wikipedia.org/wiki/Fahrenheit_451) (which gave this status code its number)
500
2549
  */
501
2550
  UNAVAILABLE_FOR_LEGAL_REASONS = 451,
502
2551
  /**
503
- * The HTTP **`500 Internal Server Error`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
504
- * This error is a generic "catch-all" response to server issues, indicating that the server cannot find a more appropriate [5XX error](/en-US/docs/Web/HTTP/Status#server_error_responses) to respond with.
2552
+ * The HTTP **`500 Internal Server Error`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
2553
+ * This error is a generic "catch-all" response to server issues, indicating that the server cannot find a more appropriate [5XX error](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) to respond with.
505
2554
  *
506
2555
  * If you're a visitor seeing `500` errors on a web page, these issues require investigation by server owners or administrators.
507
2556
  * There are many possible causes of `500` errors, including: improper server configuration, out-of-memory (OOM) issues, unhandled exceptions, improper file permissions, or other complex factors.
508
2557
  * Server administrators may proactively log occurrences of server error responses, like the `500` status code, with details about the initiating requests to improve the stability of a service in the future.
2558
+ *
2559
+ * ## Status
2560
+ *
2561
+ * ```http
2562
+ * 500 Internal Server Error
2563
+ * ```
2564
+ *
2565
+ * ## Examples
2566
+ *
2567
+ * ### 500 server error response
2568
+ *
2569
+ * The following request tries to fetch a webpage, but receives a 500 response in return.
2570
+ * The response body contains a page describing the server state with a link to a support page for visitors.
2571
+ * An identifier is contained in the response body for illustration of a method that may help server administrators narrow down the root cause of the problem:
2572
+ *
2573
+ * ```http
2574
+ * GET /highlights HTTP/1.1
2575
+ * Host: example.com
2576
+ * User-Agent: curl/8.6.0
2577
+ * Accept: * /*
2578
+ * ```
2579
+ *
2580
+ * ```http
2581
+ * HTTP/1.1 500 Internal Server Error
2582
+ * Content-Type: text/html;
2583
+ * Content-Length: 123
2584
+ *
2585
+ *
2586
+ * ```
2587
+ *
2588
+ * ## Specifications
2589
+ *
2590
+ * ## See also
2591
+ *
2592
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
509
2593
  */
510
2594
  INTERNAL_SERVER_ERROR = 500,
511
2595
  /**
512
- * The HTTP **`501 Not Implemented`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code means that the server does not support the functionality required to fulfill the request.
2596
+ * The HTTP **`501 Not Implemented`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code means that the server does not support the functionality required to fulfill the request.
513
2597
  *
514
2598
  * A response with this status may also include a [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header, telling the client that they can retry the request after the specified time has elapsed.
515
2599
  * A `501` response is cacheable by default unless caching headers instruct otherwise.
@@ -523,10 +2607,43 @@ declare enum HttpStatusCode {
523
2607
  *
524
2608
  * A `501` response can occur if proxies cannot not handle request methods used in the context of HTTP Extension Framework ([2774](https://developer.mozilla.org/en-US/docs/RFC/2774)) applications.
525
2609
  * This status can also occur in Web Distributed Authoring and Versioning ([WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV)) when a request method (`SEARCH`, `PROPFIND`) does not have a URL handler configured to process it.
2610
+ *
2611
+ * ## Status
2612
+ *
2613
+ * ```http
2614
+ * 501 Not Implemented
2615
+ * ```
2616
+ *
2617
+ * ## Examples
2618
+ *
2619
+ * ### Extension method not supported
2620
+ *
2621
+ * In the following HTTP Extension Framework example, a client sends a request with a mandatory extension specified in the `C-MAN` header.
2622
+ * The [Connection](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header specifies that these extensions are to be handled on a [hop-by-hop](/en-US/docs/Web/HTTP/Reference/Headers#hop-by-hop_headers) basis.
2623
+ * A proxy refuses to forward the `M-GET` method, and sends a `501` error in response:
2624
+ *
2625
+ * ```http
2626
+ * M-GET /document HTTP/1.1
2627
+ * Host: example.com
2628
+ * C-Man: "http://www.example.org/"
2629
+ * Connection: C-Man
2630
+ * ```
2631
+ *
2632
+ * ```http
2633
+ * HTTP/1.1 501 Not Implemented
2634
+ * ```
2635
+ *
2636
+ * ## Specifications
2637
+ *
2638
+ * ## See also
2639
+ *
2640
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2641
+ * - [510 Not Extended](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/510)
2642
+ * - [HTTP 501 errors](https://learn.microsoft.com/en-us/aspnet/web-api/overview/testing-and-debugging/troubleshooting-http-405-errors-after-publishing-web-api-applications) in Microsoft ASP.NET documentation
526
2643
  */
527
2644
  NOT_IMPLEMENTED = 501,
528
2645
  /**
529
- * The HTTP **`502 Bad Gateway`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that a server was acting as a gateway or [proxy](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server) and that it received an invalid response from the upstream server.
2646
+ * The HTTP **`502 Bad Gateway`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that a server was acting as a gateway or [proxy](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server) and that it received an invalid response from the upstream server.
530
2647
  *
531
2648
  * This response is similar to a [500 Internal Server Error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) response in the sense that it is a generic "catch-call" for server errors.
532
2649
  * The difference is that it is specific to the point in the request chain that the error has occurred.
@@ -536,10 +2653,45 @@ declare enum HttpStatusCode {
536
2653
  * There are many causes of `502` errors, and fixing such problems probably requires investigation by server owners or administrators.
537
2654
  * Exceptions are client networking errors, particularly if the service works for other visitors, and if clients use VPNs or other custom networking setups.
538
2655
  * In such cases, clients should check network settings, firewall setup, proxy settings, DNS configuration, etc.
2656
+ *
2657
+ * ## Status
2658
+ *
2659
+ * ```http
2660
+ * 502 Bad Gateway
2661
+ * ```
2662
+ *
2663
+ * ## Examples
2664
+ *
2665
+ * ### 502 gateway error response
2666
+ *
2667
+ * The following request tries to fetch a webpage, but receives a `502` response in return.
2668
+ * The response body contains a page describing the server state with a link to a support page for visitors.
2669
+ *
2670
+ * ```http
2671
+ * GET /highlights HTTP/1.1
2672
+ * Host: example.com
2673
+ * User-Agent: curl/8.6.0
2674
+ * Accept: * /*
2675
+ * ```
2676
+ *
2677
+ * ```http
2678
+ * HTTP/1.1 502 Bad Gateway
2679
+ * Content-Type: text/html;
2680
+ * Content-Length: 123
2681
+ *
2682
+ *
2683
+ * ```
2684
+ *
2685
+ * ## Specifications
2686
+ *
2687
+ * ## See also
2688
+ *
2689
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2690
+ * - [504 Gateway Timeout](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504)
539
2691
  */
540
2692
  BAD_GATEWAY = 502,
541
2693
  /**
542
- * The HTTP **`503 Service Unavailable`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that the server is not ready to handle the request.
2694
+ * The HTTP **`503 Service Unavailable`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that the server is not ready to handle the request.
543
2695
  *
544
2696
  * Common causes are that a server is down for maintenance or overloaded.
545
2697
  * During maintenance, server administrators may temporarily route all traffic to a `503` page, or this may happen automatically during software updates.
@@ -553,61 +2705,365 @@ declare enum HttpStatusCode {
553
2705
  *
554
2706
  * > [!NOTE]
555
2707
  * > Caching-related headers sent with this response require special attention; a `503` indicates a temporary issue and responses shouldn't usually be cached as clients may receive outdated error pages after a fix has been deployed.
2708
+ *
2709
+ * ## Status
2710
+ *
2711
+ * ```http
2712
+ * 503 Service Unavailable
2713
+ * ```
2714
+ *
2715
+ * ## Examples
2716
+ *
2717
+ * ### 503 server error response
2718
+ *
2719
+ * The following request tries to fetch a webpage, but receives a `503` response.
2720
+ * The response body contains a page describing the server state with a link to a support page for visitors.
2721
+ * An identifier is contained in the response body for illustration of a method that may help server administrators narrow down the root cause of the problem:
2722
+ *
2723
+ * ```http
2724
+ * GET /highlights HTTP/1.1
2725
+ * Host: example.com
2726
+ * User-Agent: curl/8.6.0
2727
+ * Accept: * /*
2728
+ * ```
2729
+ *
2730
+ * ```http
2731
+ * HTTP/1.1 503 Service Unavailable
2732
+ * Content-Type: text/html;
2733
+ * Content-Length: 123
2734
+ *
2735
+ *
2736
+ * ```
2737
+ *
2738
+ * ## Specifications
2739
+ *
2740
+ * ## See also
2741
+ *
2742
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2743
+ * - [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After)
556
2744
  */
557
2745
  SERVICE_UNAVAILABLE = 503,
558
2746
  /**
559
- * The HTTP **`504 Gateway Timeout`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that the server, while acting as a gateway or [proxy](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server), did not get a response in time from the upstream server in order to complete the request.
2747
+ * The HTTP **`504 Gateway Timeout`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that the server, while acting as a gateway or [proxy](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server), did not get a response in time from the upstream server in order to complete the request.
560
2748
  * This is similar to a [502 Bad Gateway](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502), except that in a `504` status, the proxy or gateway did not receive any HTTP response from the origin within a certain time.
561
2749
  *
562
2750
  * There are many causes of `504` errors, and fixing such problems likely requires investigation and debugging by server administrators, or the site may work again at a later time.
563
2751
  * Exceptions are client networking errors, particularly if the service works for other visitors, and if clients use VPNs or other custom networking setups.
564
2752
  * In such cases, clients should check network settings, firewall setup, proxy settings, DNS configuration, etc.
2753
+ *
2754
+ * ## Status
2755
+ *
2756
+ * ```http
2757
+ * 504 Gateway Timeout
2758
+ * ```
2759
+ *
2760
+ * ## Examples
2761
+ *
2762
+ * ### 504 gateway timeout response
2763
+ *
2764
+ * The following request tries to fetch a webpage, but receives a `504` response in return.
2765
+ * The response body contains a page describing the server state with a link to a support page for visitors.
2766
+ *
2767
+ * ```http
2768
+ * GET /highlights HTTP/1.1
2769
+ * Host: example.com
2770
+ * User-Agent: curl/8.6.0
2771
+ * Accept: * /*
2772
+ * ```
2773
+ *
2774
+ * ```http
2775
+ * HTTP/1.1 504 Gateway Timeout
2776
+ * Content-Type: text/html;
2777
+ * Content-Length: 123
2778
+ *
2779
+ *
2780
+ * ```
2781
+ *
2782
+ * ## Specifications
2783
+ *
2784
+ * ## See also
2785
+ *
2786
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2787
+ * - [502 Bad Gateway](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502)
565
2788
  */
566
2789
  GATEWAY_TIMEOUT = 504,
567
2790
  /**
568
- * The HTTP **`505 HTTP Version Not Supported`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that the HTTP version used in the request is not supported by the server.
2791
+ * The HTTP **`505 HTTP Version Not Supported`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that the HTTP version used in the request is not supported by the server.
569
2792
  *
570
2793
  * It's common to see this error when a request line is improperly formed such as `GET /path to resource HTTP/1.1` or with `\n` terminating the request line instead of `\r\n`.
571
2794
  * For example, intermediaries such as load balancers may not handle request lines of a forwarded request as illustrated in the example below.
2795
+ *
2796
+ * ## Status
2797
+ *
2798
+ * ```http
2799
+ * 505 HTTP Version Not Supported
2800
+ * ```
2801
+ *
2802
+ * ## Examples
2803
+ *
2804
+ * ### A 505 due to malformed request-line
2805
+ *
2806
+ * In the following example, a client requests `example.com/dog%20trainers`, but due to incorrect load balancer configuration, the [percent encoding](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding) in the URL is not handled properly.
2807
+ * In this case, the origin server sees `trainers` instead of the HTTP version, and a `505` response is returned instead.
2808
+ * A request identifier is contained in the response body for illustration of a way that may help server administrators narrow down the root cause of the problem:
2809
+ *
2810
+ * ```http
2811
+ * GET /dog trainers HTTP/1.1
2812
+ * Host: example.com
2813
+ * ```
2814
+ *
2815
+ * ```http
2816
+ * HTTP/1.1 505 HTTP Version Not Supported
2817
+ * Content-Type: text/html;
2818
+ * Content-Length: 123
2819
+ *
2820
+ *
2821
+ * ```
2822
+ *
2823
+ * ## Specifications
2824
+ *
2825
+ * ## See also
2826
+ *
2827
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2828
+ * - [Upgrade](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade) header
572
2829
  */
573
2830
  HTTP_VERSION_NOT_SUPPORTED = 505,
574
2831
  /**
575
- * The HTTP **`506 Variant Also Negotiates`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code is returned during content negotiation when there is recursive loop in the process of selecting a resource.
2832
+ * The HTTP **`506 Variant Also Negotiates`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code is returned during content negotiation when there is recursive loop in the process of selecting a resource.
576
2833
  *
577
- * [Agent-driven content negotiation](/en-US/docs/Web/HTTP/Content_negotiation#agent-driven_negotiation) enables a client and server to collaboratively decide the best variant of a given resource when the server has multiple variants.
2834
+ * [Agent-driven content negotiation](/en-US/docs/Web/HTTP/Guides/Content_negotiation#agent-driven_negotiation) enables a client and server to collaboratively decide the best variant of a given resource when the server has multiple variants.
578
2835
  * A server sends a `506` status code due to server misconfiguration that results in circular references when creating responses.
579
2836
  *
580
2837
  * Lack of standardization of how clients automatically choose from responses, and the additional round-trips that slow down client-server interaction mean this mechanism is rarely used.
581
- * [Server-driven content negotiation](/en-US/docs/Web/HTTP/Content_negotiation#server-driven_content_negotiation) is far more common, where a server directly chooses the most appropriate resource for the client based on the request headers ([Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language), [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept), etc.).
2838
+ * [Server-driven content negotiation](/en-US/docs/Web/HTTP/Guides/Content_negotiation#server-driven_content_negotiation) is far more common, where a server directly chooses the most appropriate resource for the client based on the request headers ([Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language), [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept), etc.).
2839
+ *
2840
+ * ## Status
2841
+ *
2842
+ * ```http
2843
+ * 506 Variant Also Negotiates
2844
+ * ```
2845
+ *
2846
+ * ## Examples
2847
+ *
2848
+ * ### Resource with variants
2849
+ *
2850
+ * In the following example, a client requests a page in the `fr` locale using the [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) header.
2851
+ * This can be performed using curl:
2852
+ *
2853
+ * ```bash
2854
+ * curl -H "Negotiate: trans" -H "Accept-Language: fr;" http://example.com/index
2855
+ * ```
2856
+ *
2857
+ * This produces the following request:
2858
+ *
2859
+ * ```http
2860
+ * GET /index HTTP/1.1
2861
+ * Host: example.com
2862
+ * User-Agent: curl/8.7.1
2863
+ * Accept: * /*
2864
+ * Negotiate: trans
2865
+ * Accept-Language: fr
2866
+ * ```
2867
+ *
2868
+ * Due to server misconfiguration, the variant response for `fr` points to a [type map](https://httpd.apache.org/docs/trunk/mod/mod_negotiation.html#typemaps) which itself causes transparent negotiation to be performed.
2869
+ * The server may detect this condition by the presence of a `TCN` header in a choice response before it is sent:
2870
+ *
2871
+ * ```http
2872
+ * HTTP/1.1 506 Variant Also Negotiates
2873
+ * Date: Mon, 22 Jul 2024 10:00:00 GMT
2874
+ * Server: Apache/2.4.41 (Unix)
2875
+ * Content-Type: text/html; charset=UTF-8
2876
+ * Content-Length: 233
2877
+ * TCN: list
2878
+ * Vary: negotiate,accept-language
2879
+ * Alternates: {"index.html.en" 1 {type text/html} {language en} {length 48}}, {"another-map.html.fr.map" 1 {type text/html} {language fr} {length 45}}}}
2880
+ *
2881
+ *
2882
+ * ```
2883
+ *
2884
+ * ## Specifications
2885
+ *
2886
+ * ## See also
2887
+ *
2888
+ * - [300 Multiple Choices](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/300)
2889
+ * - [2295](https://developer.mozilla.org/en-US/docs/RFC/2295)
2890
+ * - [Content negotiation](/en-US/docs/Web/HTTP/Guides/Content_negotiation)
2891
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2892
+ * - [Content Negotiation](https://httpd.apache.org/docs/2.4/content-negotiation.html) in Apache HTTP Server documentation
2893
+ * - [Apache httpd `mod_negotiation.c` source](https://github.com/apache/httpd/blob/6a2433cb3fbc30c8a55f450a046e4b0f69e73143/modules/mappers/mod_negotiation.c#L2687-L2691) showing conditions that trigger `HTTP_VARIANT_ALSO_VARIES` response.
582
2894
  */
583
2895
  VARIANT_ALSO_NEGOTIATES = 506,
584
2896
  /**
585
- * The HTTP **`507 Insufficient Storage`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that an action could not be performed because the server does not have enough available storage to successfully complete the request.
2897
+ * The HTTP **`507 Insufficient Storage`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that an action could not be performed because the server does not have enough available storage to successfully complete the request.
586
2898
  *
587
2899
  * This status code was first used in the context of Web Distributed Authoring and Versioning ([WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV)), but has propagated into other use cases to describe situations where server resources are exhausted.
588
2900
  * Common causes of this error can be from server directories running out of available space, not enough available RAM for an operation, or internal limits reached (such as application-specific memory limits, for example).
589
2901
  * The request causing this error does not necessarily need to include content, as it may be a request that would create a resource on the server if it was successful.
590
2902
  *
591
2903
  * This issue is considered temporary, as opposed to a [413 Content Too Large](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413), which indicates that the client request is too large for the server to process regardless of server resource constraints.
2904
+ *
2905
+ * ## Status
2906
+ *
2907
+ * ```http
2908
+ * 507 Insufficient Storage
2909
+ * ```
2910
+ *
2911
+ * ## Examples
2912
+ *
2913
+ * ### 507 response indicating storage issues
2914
+ *
2915
+ * The following request attempts to upload a file to a server which has insufficient storage available.
2916
+ * The server responds with a `507` to indicate that its resources are exhausted:
2917
+ *
2918
+ * ```http
2919
+ * POST /upload HTTP/1.1
2920
+ * Host: example.com
2921
+ * Content-Type: image/jpeg
2922
+ * Content-Length: 123456
2923
+ *
2924
+ * [JPG file data]
2925
+ * ```
2926
+ *
2927
+ * ```http
2928
+ * HTTP/1.1 507 Insufficient Storage
2929
+ * Date: Mon, 22 Jul 2024 10:00:00 GMT
2930
+ * Server: Apache/2.4.41 (Unix)
2931
+ * Content-Type: text/html; charset=UTF-8
2932
+ * Content-Length: 230
2933
+ *
2934
+ *
2935
+ * ```
2936
+ *
2937
+ * ## Specifications
2938
+ *
2939
+ * ## See also
2940
+ *
2941
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2942
+ * - [413 Content Too Large](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413)
592
2943
  */
593
2944
  INSUFFICIENT_STORAGE = 507,
594
2945
  /**
595
- * The HTTP **`508 Loop Detected`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that the entire operation failed because it encountered an infinite loop while processing a request with `Depth: infinity`.
2946
+ * The HTTP **`508 Loop Detected`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that the entire operation failed because it encountered an infinite loop while processing a request with `Depth: infinity`.
596
2947
  *
597
2948
  * The status may be given in the context of the Web Distributed Authoring and Versioning ([WebDAV](https://developer.mozilla.org/en-US/docs/Glossary/WebDAV)).
598
2949
  * It was introduced as a fallback for cases where WebDAV clients do not support [208 Already Reported](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/208) responses (when requests do not explicitly include a `DAV` header).
2950
+ *
2951
+ * ## Status
2952
+ *
2953
+ * ```http
2954
+ * 508 Loop Detected
2955
+ * ```
2956
+ *
2957
+ * ## Examples
2958
+ *
2959
+ * ### Infinite loop in WebDAV search
2960
+ *
2961
+ * ```http
2962
+ * PROPFIND /Coll/ HTTP/1.1
2963
+ * Host: example.com
2964
+ * Depth: infinity
2965
+ * Content-Type: application/xml; charset="utf-8"
2966
+ * Content-Length: 125
2967
+ *
2968
+ *
2969
+ * ```
2970
+ *
2971
+ * ```http
2972
+ * HTTP/1.1 508 Loop Detected
2973
+ * Content-Type: application/json; charset=utf-8
2974
+ * Server: Microsoft-IIS/8.0
2975
+ * Date: Wed, 15 May 2013 02:38:57 GMT
2976
+ * Content-Length: 72
2977
+ *
2978
+ * {
2979
+ * "Message": "Please check the resources for cyclic references and try again."
2980
+ * }
2981
+ * ```
2982
+ *
2983
+ * ## Specifications
2984
+ *
2985
+ * ## See also
2986
+ *
2987
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
2988
+ * - [208 Already Reported](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/208)
599
2989
  */
600
2990
  LOOP_DETECTED = 508,
601
2991
  /**
602
- * The HTTP **`510 Not Extended`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code is sent when the client request declares an HTTP Extension ([2774](https://developer.mozilla.org/en-US/docs/RFC/2774)) that should be used to process the request, but the extension is not supported.
2992
+ * The HTTP **`510 Not Extended`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code is sent when the client request declares an HTTP Extension ([2774](https://developer.mozilla.org/en-US/docs/RFC/2774)) that should be used to process the request, but the extension is not supported.
2993
+ *
2994
+ * ## Status
2995
+ *
2996
+ * ```http
2997
+ * 510 Not Extended
2998
+ * ```
2999
+ *
3000
+ * ## Examples
3001
+ *
3002
+ * ### Extension not supported
3003
+ *
3004
+ * In the following example, a client sends a request with a mandatory extension specified in the `C-MAN` header.
3005
+ * The [Connection](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header specifies that these extensions are to be handled on a [hop-by-hop](/en-US/docs/Web/HTTP/Reference/Headers#hop-by-hop_headers) basis.
3006
+ * A [proxy](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server) forwards the extended request, but the [Connection](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header is stripped out in transit.
3007
+ * Because the origin server doesn't receive any information about the `M-GET` method, it sends a `510` in response:
3008
+ *
3009
+ * ```http
3010
+ * M-GET /document HTTP/1.1
3011
+ * Host: example.com
3012
+ * C-Man: "http://www.example.org/"
3013
+ * Connection: C-Man
3014
+ * ```
3015
+ *
3016
+ * ```http
3017
+ * HTTP/1.1 510 Not Extended
3018
+ * ```
3019
+ *
3020
+ * ## Specifications
3021
+ *
3022
+ * ## See also
3023
+ *
3024
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
603
3025
  */
604
3026
  NOT_EXTENDED = 510,
605
3027
  /**
606
- * The HTTP **`511 Network Authentication Required`** [server error response](/en-US/docs/Web/HTTP/Status#server_error_responses) status code indicates that the client needs to authenticate to gain network access.
3028
+ * The HTTP **`511 Network Authentication Required`** [server error response](/en-US/docs/Web/HTTP/Reference/Status#server_error_responses) status code indicates that the client needs to authenticate to gain network access.
607
3029
  * This status is not generated by origin servers, but by intercepting [proxies](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server) that control access to a network.
608
3030
  *
609
3031
  * Network operators sometimes require some authentication, acceptance of terms, or other user interaction before granting access (for example in an internet café or at an airport).
610
3032
  * They often identify clients who have not done so using their Media Access Control (MAC) addresses.
3033
+ *
3034
+ * ## Status
3035
+ *
3036
+ * ```http
3037
+ * 511 Network Authentication Required
3038
+ * ```
3039
+ *
3040
+ * ## Examples
3041
+ *
3042
+ * ### 511 response for a GET request
3043
+ *
3044
+ * In the following example, a client tries to access a resource on a network.
3045
+ * The request is not authenticated, and a proxy sends a `511` status code to prompt the visitor to log in.
3046
+ * The `511` ensures that non-browser clients will not interpret the response as being from the origin server.
3047
+ * Browsers are redirected automatically via the [meta](https://developer.mozilla.org/en-US/docs/HTMLelement/meta) tag after 10 seconds, or by clicking the link in the response body:
3048
+ *
3049
+ * ```http
3050
+ * GET /document HTTP/1.1
3051
+ * Host: example.com
3052
+ * ```
3053
+ *
3054
+ * ```http
3055
+ * HTTP/1.1 511 Network Authentication Required
3056
+ * Content-Type: text/html
3057
+ *
3058
+ *
3059
+ * ```
3060
+ *
3061
+ * ## Specifications
3062
+ *
3063
+ * ## See also
3064
+ *
3065
+ * - [HTTP response status codes](/en-US/docs/Web/HTTP/Reference/Status)
3066
+ * - [Proxy server](https://developer.mozilla.org/en-US/docs/Glossary/Proxy_server)
611
3067
  */
612
3068
  NETWORK_AUTHENTICATION_REQUIRED = 511
613
3069
  }