@forklaunch/core 0.2.37 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/lib/{src/database/mikro/models/entities/base.entity.d.ts → base.entity-DNfmMOgd.d.mts} +3 -2
  2. package/lib/base.entity-DNfmMOgd.d.ts +27 -0
  3. package/lib/{src/cache/redisTtlCache.d.ts → cache/index.d.mts} +67 -4
  4. package/lib/cache/index.d.ts +130 -0
  5. package/lib/cache/index.js +133 -0
  6. package/lib/cache/index.mjs +105 -0
  7. package/lib/controllers/index.d.mts +5 -0
  8. package/lib/controllers/index.d.ts +5 -0
  9. package/lib/controllers/index.js +18 -0
  10. package/lib/controllers/index.mjs +0 -0
  11. package/lib/database/index.d.mts +37 -0
  12. package/lib/{src/database/mikro/models/entities/mongo.base.entity.d.ts → database/index.d.ts} +5 -2
  13. package/lib/database/index.js +78 -0
  14. package/lib/database/index.mjs +53 -0
  15. package/lib/dtoMapper/index.d.mts +215 -0
  16. package/lib/dtoMapper/index.d.ts +215 -0
  17. package/lib/dtoMapper/index.js +235 -0
  18. package/lib/dtoMapper/index.mjs +213 -0
  19. package/lib/http/index.d.mts +910 -0
  20. package/lib/http/index.d.ts +910 -0
  21. package/lib/http/index.js +2189 -0
  22. package/lib/http/index.mjs +2134 -0
  23. package/lib/services/index.d.mts +69 -0
  24. package/lib/services/index.d.ts +69 -0
  25. package/lib/services/index.js +244 -0
  26. package/lib/services/index.mjs +215 -0
  27. package/package.json +68 -55
  28. package/lib/src/cache/index.d.ts +0 -5
  29. package/lib/src/cache/index.d.ts.map +0 -1
  30. package/lib/src/cache/index.js +0 -4
  31. package/lib/src/cache/interfaces/ttlCache.interface.d.ts +0 -48
  32. package/lib/src/cache/interfaces/ttlCache.interface.d.ts.map +0 -1
  33. package/lib/src/cache/interfaces/ttlCache.interface.js +0 -1
  34. package/lib/src/cache/redisTtlCache.d.ts.map +0 -1
  35. package/lib/src/cache/redisTtlCache.js +0 -98
  36. package/lib/src/cache/types/ttlCacheRecord.types.d.ts +0 -14
  37. package/lib/src/cache/types/ttlCacheRecord.types.d.ts.map +0 -1
  38. package/lib/src/cache/types/ttlCacheRecord.types.js +0 -1
  39. package/lib/src/cache/utils/cacheKey.d.ts +0 -2
  40. package/lib/src/cache/utils/cacheKey.d.ts.map +0 -1
  41. package/lib/src/cache/utils/cacheKey.js +0 -3
  42. package/lib/src/controllers/index.d.ts +0 -2
  43. package/lib/src/controllers/index.d.ts.map +0 -1
  44. package/lib/src/controllers/index.js +0 -1
  45. package/lib/src/controllers/interfaces/controller.interface.d.ts +0 -4
  46. package/lib/src/controllers/interfaces/controller.interface.d.ts.map +0 -1
  47. package/lib/src/controllers/interfaces/controller.interface.js +0 -1
  48. package/lib/src/database/index.d.ts +0 -3
  49. package/lib/src/database/index.d.ts.map +0 -1
  50. package/lib/src/database/index.js +0 -2
  51. package/lib/src/database/mikro/models/entities/base.entity.d.ts.map +0 -1
  52. package/lib/src/database/mikro/models/entities/base.entity.js +0 -42
  53. package/lib/src/database/mikro/models/entities/mongo.base.entity.d.ts.map +0 -1
  54. package/lib/src/database/mikro/models/entities/mongo.base.entity.js +0 -51
  55. package/lib/src/dtoMapper/index.d.ts +0 -3
  56. package/lib/src/dtoMapper/index.d.ts.map +0 -1
  57. package/lib/src/dtoMapper/index.js +0 -2
  58. package/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts +0 -18
  59. package/lib/src/dtoMapper/interfaces/dtoMapper.interface.d.ts.map +0 -1
  60. package/lib/src/dtoMapper/interfaces/dtoMapper.interface.js +0 -1
  61. package/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts +0 -72
  62. package/lib/src/dtoMapper/models/baseDtoMapper.model.d.ts.map +0 -1
  63. package/lib/src/dtoMapper/models/baseDtoMapper.model.js +0 -76
  64. package/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts +0 -68
  65. package/lib/src/dtoMapper/models/requestDtoMapper.model.d.ts.map +0 -1
  66. package/lib/src/dtoMapper/models/requestDtoMapper.model.js +0 -71
  67. package/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts +0 -67
  68. package/lib/src/dtoMapper/models/responseDtoMapper.model.d.ts.map +0 -1
  69. package/lib/src/dtoMapper/models/responseDtoMapper.model.js +0 -68
  70. package/lib/src/dtoMapper/types/dtoMapper.types.d.ts +0 -9
  71. package/lib/src/dtoMapper/types/dtoMapper.types.d.ts.map +0 -1
  72. package/lib/src/dtoMapper/types/dtoMapper.types.js +0 -1
  73. package/lib/src/http/application/expressLikeApplication.d.ts +0 -21
  74. package/lib/src/http/application/expressLikeApplication.d.ts.map +0 -1
  75. package/lib/src/http/application/expressLikeApplication.js +0 -21
  76. package/lib/src/http/guards/isConstrainedForklaunchRouter.d.ts +0 -4
  77. package/lib/src/http/guards/isConstrainedForklaunchRouter.d.ts.map +0 -1
  78. package/lib/src/http/guards/isConstrainedForklaunchRouter.js +0 -5
  79. package/lib/src/http/guards/isExpressLikeSchemaHandler.d.ts +0 -5
  80. package/lib/src/http/guards/isExpressLikeSchemaHandler.d.ts.map +0 -1
  81. package/lib/src/http/guards/isExpressLikeSchemaHandler.js +0 -6
  82. package/lib/src/http/guards/isForklaunchExpressLikeRouter.d.ts +0 -5
  83. package/lib/src/http/guards/isForklaunchExpressLikeRouter.d.ts.map +0 -1
  84. package/lib/src/http/guards/isForklaunchExpressLikeRouter.js +0 -6
  85. package/lib/src/http/guards/isForklaunchRouter.d.ts +0 -4
  86. package/lib/src/http/guards/isForklaunchRouter.d.ts.map +0 -1
  87. package/lib/src/http/guards/isForklaunchRouter.js +0 -7
  88. package/lib/src/http/guards/isHttpContractDetails.d.ts +0 -7
  89. package/lib/src/http/guards/isHttpContractDetails.d.ts.map +0 -1
  90. package/lib/src/http/guards/isHttpContractDetails.js +0 -9
  91. package/lib/src/http/guards/isPathParamContractDetails.d.ts +0 -4
  92. package/lib/src/http/guards/isPathParamContractDetails.d.ts.map +0 -1
  93. package/lib/src/http/guards/isPathParamContractDetails.js +0 -10
  94. package/lib/src/http/guards/isResponseShape.d.ts +0 -3
  95. package/lib/src/http/guards/isResponseShape.d.ts.map +0 -1
  96. package/lib/src/http/guards/isResponseShape.js +0 -7
  97. package/lib/src/http/guards/isTypedHandler.d.ts +0 -5
  98. package/lib/src/http/guards/isTypedHandler.d.ts.map +0 -1
  99. package/lib/src/http/guards/isTypedHandler.js +0 -6
  100. package/lib/src/http/handlers/delete.d.ts +0 -9
  101. package/lib/src/http/handlers/delete.d.ts.map +0 -1
  102. package/lib/src/http/handlers/delete.js +0 -4
  103. package/lib/src/http/handlers/get.d.ts +0 -9
  104. package/lib/src/http/handlers/get.d.ts.map +0 -1
  105. package/lib/src/http/handlers/get.js +0 -4
  106. package/lib/src/http/handlers/head.d.ts +0 -9
  107. package/lib/src/http/handlers/head.d.ts.map +0 -1
  108. package/lib/src/http/handlers/head.js +0 -4
  109. package/lib/src/http/handlers/middleware.d.ts +0 -9
  110. package/lib/src/http/handlers/middleware.d.ts.map +0 -1
  111. package/lib/src/http/handlers/middleware.js +0 -4
  112. package/lib/src/http/handlers/options.d.ts +0 -9
  113. package/lib/src/http/handlers/options.d.ts.map +0 -1
  114. package/lib/src/http/handlers/options.js +0 -4
  115. package/lib/src/http/handlers/patch.d.ts +0 -9
  116. package/lib/src/http/handlers/patch.d.ts.map +0 -1
  117. package/lib/src/http/handlers/patch.js +0 -4
  118. package/lib/src/http/handlers/post.d.ts +0 -9
  119. package/lib/src/http/handlers/post.d.ts.map +0 -1
  120. package/lib/src/http/handlers/post.js +0 -4
  121. package/lib/src/http/handlers/put.d.ts +0 -9
  122. package/lib/src/http/handlers/put.d.ts.map +0 -1
  123. package/lib/src/http/handlers/put.js +0 -4
  124. package/lib/src/http/handlers/trace.d.ts +0 -9
  125. package/lib/src/http/handlers/trace.d.ts.map +0 -1
  126. package/lib/src/http/handlers/trace.js +0 -4
  127. package/lib/src/http/handlers/typedAuthHandler.d.ts +0 -5
  128. package/lib/src/http/handlers/typedAuthHandler.d.ts.map +0 -1
  129. package/lib/src/http/handlers/typedAuthHandler.js +0 -3
  130. package/lib/src/http/handlers/typedHandler.d.ts +0 -21
  131. package/lib/src/http/handlers/typedHandler.d.ts.map +0 -1
  132. package/lib/src/http/handlers/typedHandler.js +0 -30
  133. package/lib/src/http/index.d.ts +0 -23
  134. package/lib/src/http/index.d.ts.map +0 -1
  135. package/lib/src/http/index.js +0 -22
  136. package/lib/src/http/interfaces/expressLikeRouter.interface.d.ts +0 -24
  137. package/lib/src/http/interfaces/expressLikeRouter.interface.d.ts.map +0 -1
  138. package/lib/src/http/interfaces/expressLikeRouter.interface.js +0 -1
  139. package/lib/src/http/middleware/request/auth.middleware.d.ts +0 -16
  140. package/lib/src/http/middleware/request/auth.middleware.d.ts.map +0 -1
  141. package/lib/src/http/middleware/request/auth.middleware.js +0 -143
  142. package/lib/src/http/middleware/request/cors.middleware.d.ts +0 -13
  143. package/lib/src/http/middleware/request/cors.middleware.d.ts.map +0 -1
  144. package/lib/src/http/middleware/request/cors.middleware.js +0 -15
  145. package/lib/src/http/middleware/request/createContext.middleware.d.ts +0 -15
  146. package/lib/src/http/middleware/request/createContext.middleware.d.ts.map +0 -1
  147. package/lib/src/http/middleware/request/createContext.middleware.js +0 -26
  148. package/lib/src/http/middleware/request/enrichDetails.middleware.d.ts +0 -15
  149. package/lib/src/http/middleware/request/enrichDetails.middleware.d.ts.map +0 -1
  150. package/lib/src/http/middleware/request/enrichDetails.middleware.js +0 -19
  151. package/lib/src/http/middleware/request/parse.middleware.d.ts +0 -17
  152. package/lib/src/http/middleware/request/parse.middleware.d.ts.map +0 -1
  153. package/lib/src/http/middleware/request/parse.middleware.js +0 -43
  154. package/lib/src/http/middleware/response/parse.middleware.d.ts +0 -31
  155. package/lib/src/http/middleware/response/parse.middleware.d.ts.map +0 -1
  156. package/lib/src/http/middleware/response/parse.middleware.js +0 -52
  157. package/lib/src/http/openApiV3Generator/openApiV3Generator.d.ts +0 -14
  158. package/lib/src/http/openApiV3Generator/openApiV3Generator.d.ts.map +0 -1
  159. package/lib/src/http/openApiV3Generator/openApiV3Generator.js +0 -169
  160. package/lib/src/http/router/expressLikeRouter.d.ts +0 -138
  161. package/lib/src/http/router/expressLikeRouter.d.ts.map +0 -1
  162. package/lib/src/http/router/expressLikeRouter.js +0 -483
  163. package/lib/src/http/types/apiDefinition.types.d.ts +0 -260
  164. package/lib/src/http/types/apiDefinition.types.d.ts.map +0 -1
  165. package/lib/src/http/types/apiDefinition.types.js +0 -1
  166. package/lib/src/http/types/contractDetails.types.d.ts +0 -211
  167. package/lib/src/http/types/contractDetails.types.d.ts.map +0 -1
  168. package/lib/src/http/types/contractDetails.types.js +0 -1
  169. package/lib/src/http/types/expressLikeRouter.types.d.ts +0 -51
  170. package/lib/src/http/types/expressLikeRouter.types.d.ts.map +0 -1
  171. package/lib/src/http/types/expressLikeRouter.types.js +0 -1
  172. package/lib/src/http/types/router.types.d.ts +0 -32
  173. package/lib/src/http/types/router.types.d.ts.map +0 -1
  174. package/lib/src/http/types/router.types.js +0 -1
  175. package/lib/src/http/types/typedHandler.types.d.ts +0 -10
  176. package/lib/src/http/types/typedHandler.types.d.ts.map +0 -1
  177. package/lib/src/http/types/typedHandler.types.js +0 -1
  178. package/lib/src/http/utils/enrichExpressLikeSend.d.ts +0 -32
  179. package/lib/src/http/utils/enrichExpressLikeSend.d.ts.map +0 -1
  180. package/lib/src/http/utils/enrichExpressLikeSend.js +0 -50
  181. package/lib/src/http/utils/httpStatusCodes.d.ts +0 -75
  182. package/lib/src/http/utils/httpStatusCodes.d.ts.map +0 -1
  183. package/lib/src/http/utils/httpStatusCodes.js +0 -1039
  184. package/lib/src/services/configInjector.d.ts +0 -21
  185. package/lib/src/services/configInjector.d.ts.map +0 -1
  186. package/lib/src/services/configInjector.js +0 -90
  187. package/lib/src/services/index.d.ts +0 -5
  188. package/lib/src/services/index.d.ts.map +0 -1
  189. package/lib/src/services/index.js +0 -4
  190. package/lib/src/services/interfaces/baseService.d.ts +0 -15
  191. package/lib/src/services/interfaces/baseService.d.ts.map +0 -1
  192. package/lib/src/services/interfaces/baseService.js +0 -1
  193. package/lib/src/services/types/configInjector.types.d.ts +0 -25
  194. package/lib/src/services/types/configInjector.types.d.ts.map +0 -1
  195. package/lib/src/services/types/configInjector.types.js +0 -6
  196. package/lib/src/services/types/entityManager.types.d.ts +0 -4
  197. package/lib/src/services/types/entityManager.types.d.ts.map +0 -1
  198. package/lib/src/services/types/entityManager.types.js +0 -1
  199. package/lib/tests/configInjector.test.d.ts +0 -2
  200. package/lib/tests/configInjector.test.d.ts.map +0 -1
  201. package/lib/tests/configInjector.test.js +0 -105
  202. package/lib/tests/dtoMapper.test.d.ts +0 -2
  203. package/lib/tests/dtoMapper.test.d.ts.map +0 -1
  204. package/lib/tests/dtoMapper.test.js +0 -170
  205. package/lib/tests/expressLikeRouterInstantiation.test.d.ts +0 -2
  206. package/lib/tests/expressLikeRouterInstantiation.test.d.ts.map +0 -1
  207. package/lib/tests/expressLikeRouterInstantiation.test.js +0 -118
  208. package/lib/tests/http.middleware.test.d.ts +0 -2
  209. package/lib/tests/http.middleware.test.d.ts.map +0 -1
  210. package/lib/tests/http.middleware.test.js +0 -102
  211. package/lib/tests/openApiV3Generator.test.d.ts +0 -2
  212. package/lib/tests/openApiV3Generator.test.d.ts.map +0 -1
  213. package/lib/tests/openApiV3Generator.test.js +0 -66
  214. package/lib/tests/redisTtlCache.test.d.ts +0 -2
  215. package/lib/tests/redisTtlCache.test.d.ts.map +0 -1
  216. package/lib/tests/redisTtlCache.test.js +0 -49
  217. package/lib/tests/typedHandler.test.d.ts +0 -2
  218. package/lib/tests/typedHandler.test.d.ts.map +0 -1
  219. package/lib/tests/typedHandler.test.js +0 -3
  220. package/lib/vitest.config.d.ts +0 -3
  221. package/lib/vitest.config.d.ts.map +0 -1
  222. package/lib/vitest.config.js +0 -7
@@ -1,1039 +0,0 @@
1
- /**
2
- * Object-map of the HTTP Status Codes. Maps from the status code, to the
3
- * textual name. The key is the HTTP Status Code number, and the resulting
4
- * value will be the textual name for that Status Code.
5
- *
6
- * The comments for each item are taken from httpstatuses.com and the RFC-7231
7
- * document.
8
- *
9
- * @see https://httpstatuses.com
10
- * @see https://datatracker.ietf.org/doc/html/rfc7231
11
- */
12
- export const HTTPStatuses = {
13
- /**
14
- * The initial part of a request has been received and has not yet been
15
- * rejected by the server. The server intends to send a final response after
16
- * the request has been fully received and acted upon.
17
- *
18
- * When the request contains an Expect header field that includes a
19
- * 100-continue expectation, the 100 response indicates that the server
20
- * wishes to receive the request payload body. The client ought to continue
21
- * sending the request and discard the 100 response.
22
- *
23
- * If the request did not contain an Expect header field containing the
24
- * 100-continue expectation, the client can simply discard this interim
25
- * response.
26
- */
27
- 100: 'Continue',
28
- /**
29
- * The server understands and is willing to comply with the client's request,
30
- * via the Upgrade header field, for a change in the application protocol
31
- * being used on this connection.
32
- *
33
- * The server MUST generate an Upgrade header field in the response that
34
- * indicates which protocol(s) will be switched to immediately after the
35
- * empty line that terminates the 101 response.
36
- *
37
- * It is assumed that the server will only agree to switch protocols when it
38
- * is advantageous to do so. For example, switching to a newer version of
39
- * HTTP might be advantageous over older versions, and switching to a
40
- * real-time, synchronous protocol might be advantageous when delivering
41
- * resources that use such features.
42
- */
43
- 101: 'Switching Protocols',
44
- /**
45
- * An interim response used to inform the client that the server has accepted
46
- * the complete request, but has not yet completed it.
47
- *
48
- * This status code SHOULD only be sent when the server has a reasonable
49
- * expectation that the request will take significant time to complete. As
50
- * guidance, if a method is taking longer than 20 seconds (a reasonable, but
51
- * arbitrary value) to process the server SHOULD return a 102 (Processing)
52
- * response. The server MUST send a final response after the request has been
53
- * completed.
54
- *
55
- * Methods can potentially take a long period of time to process, especially
56
- * methods that support the Depth header. In such cases the client may
57
- * time-out the connection while waiting for a response. To prevent this the
58
- * server may return a 102 Processing status code to indicate to the client
59
- * that the server is still processing the method.
60
- */
61
- 102: 'Processing',
62
- /**
63
- * The request has succeeded.
64
- *
65
- * Aside from responses to CONNECT, a 200 response always has a payload,
66
- * though an origin server MAY generate a payload body of zero length. If no
67
- * payload is desired, an origin server ought to send 204 No Content instead.
68
- * For CONNECT, no payload is allowed because the successful result is a
69
- * tunnel, which begins immediately after the 200 response header section.
70
- *
71
- * A 200 response is cacheable by default; i.e., unless otherwise indicated
72
- * by the method definition or explicit cache controls.
73
- */
74
- 200: 'OK',
75
- /**
76
- * The request has been fulfilled and has resulted in one or more new
77
- * resources being created.
78
- *
79
- * The primary resource created by the request is identified by either a
80
- * Location header field in the response or, if no Location field is
81
- * received, by the effective request URI.
82
- *
83
- * The 201 response payload typically describes and links to the resource(s)
84
- * created. See Section 7.2 of RFC7231 for a discussion of the meaning and
85
- * purpose of validator header fields, such as ETag and Last-Modified, in a
86
- * 201 response.
87
- */
88
- 201: 'Created',
89
- /**
90
- * The request has been accepted for processing, but the processing has not
91
- * been completed. The request might or might not eventually be acted upon,
92
- * as it might be disallowed when processing actually takes place.
93
- *
94
- * There is no facility in HTTP for re-sending a status code from an
95
- * asynchronous operation.
96
- *
97
- * The 202 response is intentionally noncommittal. Its purpose is to allow a
98
- * server to accept a request for some other process (perhaps a
99
- * batch-oriented process that is only run once per day) without requiring
100
- * that the user agent's connection to the server persist until the process
101
- * is completed. The representation sent with this response ought to describe
102
- * the request's current status and point to (or embed) a status monitor that
103
- * can provide the user with an estimate of when the request will be
104
- * fulfilled.
105
- */
106
- 202: 'Accepted',
107
- /**
108
- * The request was successful but the enclosed payload has been modified from
109
- * that of the origin server's 200 OK response by a transforming proxy.
110
- *
111
- * This status code allows the proxy to notify recipients when a
112
- * transformation has been applied, since that knowledge might impact later
113
- * decisions regarding the content. For example, future cache validation
114
- * requests for the content might only be applicable along the same request
115
- * path (through the same proxies).
116
- *
117
- * The 203 response is similar to the Warning code of 214 Transformation
118
- * Applied, which has the advantage of being applicable to responses with any
119
- * status code.
120
- *
121
- * A 203 response is cacheable by default; i.e., unless otherwise indicated
122
- * by the method definition or explicit cache controls.
123
- */
124
- 203: 'Non-authoritative Information',
125
- /**
126
- * The server has successfully fulfilled the request and that there is no
127
- * additional content to send in the response payload body.
128
- *
129
- * Metadata in the response header fields refer to the target resource and
130
- * its selected representation after the requested action was applied.
131
- *
132
- * A 204 response is terminated by the first empty line after the header
133
- * fields because it cannot contain a message body.
134
- *
135
- * A 204 response is cacheable by default; i.e., unless otherwise indicated
136
- * by the method definition or explicit cache controls.
137
- */
138
- 204: 'No Content',
139
- /**
140
- * He server has fulfilled the request and desires that the user agent reset
141
- * the "document view", which caused the request to be sent, to its original
142
- * state as received from the origin server.
143
- *
144
- * This response is intended to support a common data entry use case where
145
- * the user receives content that supports data entry (a form, notepad,
146
- * canvas, etc.), enters or manipulates data in that space, causes the
147
- * entered data to be submitted in a request, and then the data entry
148
- * mechanism is reset for the next entry so that the user can easily
149
- * initiate another input action.
150
- *
151
- * Since the 205 status code implies that no additional content will be
152
- * provided, a server MUST NOT generate a payload in a 205 response. In
153
- * other words, a server MUST do one of the following for a 205 response: a)
154
- * indicate a zero-length body for the response by including a
155
- * Content-Length header field with a value of 0; b) indicate a zero-length
156
- * payload for the response by including a Transfer-Encoding header field
157
- * with a value of chunked and a message body consisting of a single chunk
158
- * of zero-length; or, c) close the connection immediately after sending the
159
- * blank line terminating the header section.
160
- */
161
- 205: 'Reset Content',
162
- /**
163
- * The server is successfully fulfilling a range request for the target
164
- * resource by transferring one or more parts of the selected representation
165
- * that correspond to the satisfiable ranges found in the request's Range
166
- * header field.
167
- *
168
- * If a single part is being transferred, the server generating the 206
169
- * response MUST generate a Content-Range header field, describing what range
170
- * of the selected representation is enclosed, and a payload consisting of
171
- * the range.
172
- *
173
- * If multiple parts are being transferred, the server generating the 206
174
- * response MUST generate a "multipart/byteranges" payload2, and a
175
- * Content-Type header field containing the multipart/byteranges media type
176
- * and its required boundary parameter. To avoid confusion with single-part
177
- * responses, a server MUST NOT generate a Content-Range header field in the
178
- * HTTP header section of a multiple part response (this field will be sent
179
- * in each part instead).
180
- *
181
- * Within the header area of each body part in the multipart payload, the
182
- * server MUST generate a Content-Range header field corresponding to the
183
- * range being enclosed in that body part. If the selected representation
184
- * would have had a Content-Type header field in a 200 OK response, the
185
- * server SHOULD generate that same Content-Type field in the header area of
186
- * each body part.
187
- *
188
- * When multiple ranges are requested, a server MAY coalesce any of the
189
- * ranges that overlap, or that are separated by a gap that is smaller than
190
- * the overhead of sending multiple parts, regardless of the order in which
191
- * the corresponding byte-range-spec appeared in the received Range header
192
- * field. Since the typical overhead between parts of a multipart/byteranges
193
- * payload is around 80 bytes, depending on the selected representation's
194
- * media type and the chosen boundary parameter length, it can be less
195
- * efficient to transfer many small disjoint parts than it is to transfer the
196
- * entire selected representation.
197
- *
198
- * A server MUST NOT generate a multipart response to a request for a single
199
- * range, since a client that does not request multiple parts might not
200
- * support multipart responses. However, a server MAY generate a
201
- * multipart/byteranges payload with only a single body part if multiple
202
- * ranges were requested and only one range was found to be satisfiable or
203
- * only one range remained after coalescing. A client that cannot process a
204
- * multipart/byteranges response MUST NOT generate a request that asks for
205
- * multiple ranges.
206
- *
207
- * When a multipart response payload is generated, the server SHOULD send the
208
- * parts in the same order that the corresponding byte-range-spec appeared in
209
- * the received Range header field, excluding those ranges that were deemed
210
- * unsatisfiable or that were coalesced into other ranges. A client that
211
- * receives a multipart response MUST inspect the Content-Range header field
212
- * present in each body part in order to determine which range is contained
213
- * in that body part; a client cannot rely on receiving the same ranges that
214
- * it requested, nor the same order that it requested.
215
- *
216
- * When a 206 response is generated, the server MUST generate the following
217
- * header fields, in addition to those required above, if the field would
218
- * have been sent in a 200 OK response to the same request: Date,
219
- * Cache-Control, ETag, Expires, Content-Location, and Vary.
220
- *
221
- * If a 206 is generated in response to a request with an If-Range header
222
- * field, the sender SHOULD NOT generate other representation header fields
223
- * beyond those required above, because the client is understood to already
224
- * have a prior response containing those header fields. Otherwise, the
225
- * sender MUST generate all of the representation header fields that would
226
- * have been sent in a 200 OK response to the same request.
227
- *
228
- * A 206 response is cacheable by default; i.e., unless otherwise indicated
229
- * by explicit cache controls.
230
- */
231
- 206: 'Partial Content',
232
- /**
233
- * A Multi-Status response conveys information about multiple resources in
234
- * situations where multiple status codes might be appropriate.
235
- *
236
- * The default Multi-Status response body is a text/xml or application/xml
237
- * HTTP entity with a 'multistatus' root element. Further elements contain
238
- * 200, 300, 400, and 500 series status codes generated during the method
239
- * invocation. 100 series status codes SHOULD NOT be recorded in a 'response'
240
- * XML element.
241
- *
242
- * Although '207' is used as the overall response status code, the recipient
243
- * needs to consult the contents of the multistatus response body for further
244
- * information about the success or failure of the method execution. The
245
- * response MAY be used in success, partial success and also in failure
246
- * situations.
247
- *
248
- * The 'multistatus' root element holds zero or more 'response' elements in
249
- * any order, each with information about an individual resource. Each
250
- * 'response' element MUST have an 'href' element to identify the resource.
251
- *
252
- * A Multi-Status response uses one out of two distinct formats for
253
- * representing the status:
254
- *
255
- * 1. A 'status' element as child of the 'response' element indicates the
256
- * status of the message execution for the identified resource as a whole.
257
- * Some method definitions provide information about specific status codes
258
- * clients should be prepared to see in a response. However, clients MUST be
259
- * able to handle other status codes, using the generic rules defined in
260
- * RFC2616 Section 10.
261
- *
262
- * 2. For PROPFIND and PROPPATCH, the format has been extended using the
263
- * 'propstat' element instead of 'status', providing information about
264
- * individual properties of a resource. This format is specific to PROPFIND
265
- * and PROPPATCH, and is described in detail in RFC4918 Section 9.1 and
266
- * RFC4918 Section 9.2.
267
- */
268
- 207: 'Multi-Status',
269
- /**
270
- * Used inside a DAV: propstat response element to avoid enumerating the
271
- * internal members of multiple bindings to the same collection repeatedly.
272
- *
273
- * For each binding to a collection inside the request's scope, only one will
274
- * be reported with a 200 status, while subsequent DAV:response elements for
275
- * all other bindings will use the 208 status, and no DAV:response elements
276
- * for their descendants are included.
277
- *
278
- * Note that the 208 status will only occur for "Depth: infinity" requests,
279
- * and that it is of particular importance when the multiple collection
280
- * bindings cause a bind loop.
281
- *
282
- * A client can request the DAV:resource-id property in a PROPFIND request to
283
- * guarantee that they can accurately reconstruct the binding structure of a
284
- * collection with multiple bindings to a single resource.
285
- *
286
- * For backward compatibility with clients not aware of the 208 status code
287
- * appearing in multistatus response bodies, it SHOULD NOT be used unless the
288
- * client has signaled support for this specification using the "DAV" request
289
- * header. Instead, a 508 Loop Detected status should be returned when a
290
- * binding loop is discovered. This allows the server to return the 508 as
291
- * the top-level return status, if it discovers it before it started the
292
- * response, or in the middle of a multistatus, if it discovers it in the
293
- * middle of streaming out a multistatus response.
294
- */
295
- 208: 'Already Reported',
296
- /**
297
- * The server has fulfilled a GET request for the resource, and the response
298
- * is a representation of the result of one or more instance-manipulations
299
- * applied to the current instance.
300
- *
301
- * The actual current instance might not be available except by combining
302
- * this response with other previous or future responses, as appropriate for
303
- * the specific instance-manipulation(s). If so, the headers of the resulting
304
- * instance are the result of combining the headers from the 226 response and
305
- * the other instances, following the rules in section 13.5.3 of the HTTP/1.1
306
- * specification.
307
- *
308
- * The request MUST have included an A-IM header field listing at least one
309
- * instance-manipulation. The response MUST include an Etag header field
310
- * giving the entity tag of the current instance.
311
- *
312
- * A response received with a status code of 226 MAY be stored by a cache and
313
- * used in reply to a subsequent request, subject to the HTTP expiration
314
- * mechanism and any Cache-Control headers, and to the requirements in
315
- * section 10.6.
316
- *
317
- * A response received with a status code of 226 MAY be used by a cache, in
318
- * conjunction with a cache entry for the base instance, to create a cache
319
- * entry for the current instance.
320
- */
321
- 226: 'IM Used',
322
- /**
323
- * The target resource has more than one representation, each with its own
324
- * more specific identifier, and information about the alternatives is being
325
- * provided so that the user (or user agent) can select a preferred
326
- * representation by redirecting its request to one or more of those
327
- * identifiers.
328
- *
329
- * In other words, the server desires that the user agent engage in reactive
330
- * negotiation to select the most appropriate representation(s) for its
331
- * needs.
332
- *
333
- * If the server has a preferred choice, the server SHOULD generate a
334
- * Location header field containing a preferred choice's URI reference. The
335
- * user agent MAY use the Location field value for automatic redirection.
336
- *
337
- * For request methods other than HEAD, the server SHOULD generate a payload
338
- * in the 300 response containing a list of representation metadata and URI
339
- * reference(s) from which the user or user agent can choose the one most
340
- * preferred. The user agent MAY make a selection from that list
341
- * automatically if it understands the provided media type. A specific format
342
- * for automatic selection is not defined by this specification because HTTP
343
- * tries to remain orthogonal to the definition of its payloads. In practice,
344
- * the representation is provided in some easily parsed format believed to be
345
- * acceptable to the user agent, as determined by shared design or content
346
- * negotiation, or in some commonly accepted hypertext format.
347
- *
348
- * A 300 response is cacheable by default; i.e., unless otherwise indicated
349
- * by the method definition or explicit cache controls.
350
- *
351
- * Note: The original proposal for the 300 status code defined the URI header
352
- * field as providing a list of alternative representations, such that it
353
- * would be usable for 200, 300, and 406 responses and be transferred in
354
- * responses to the HEAD method. However, lack of deployment and disagreement
355
- * over syntax led to both URI and Alternates (a subsequent proposal) being
356
- * dropped from this specification. It is possible to communicate the list
357
- * using a set of Link header fields3, each with a relationship of
358
- * "alternate", though deployment is a chicken-and-egg problem.
359
- */
360
- 300: 'Multiple Choices',
361
- /**
362
- * The target resource has been assigned a new permanent URI and any future
363
- * references to this resource ought to use one of the enclosed URIs.
364
- *
365
- * Clients with link-editing capabilities ought to automatically re-link
366
- * references to the effective request URI to one or more of the new
367
- * references sent by the server, where possible.
368
- *
369
- * The server SHOULD generate a Location header field in the response
370
- * containing a preferred URI reference for the new permanent URI. The user
371
- * agent MAY use the Location field value for automatic redirection. The
372
- * server's response payload usually contains a short hypertext note with a
373
- * hyperlink to the new URI(s).
374
- *
375
- * Note: For historical reasons, a user agent MAY change the request method
376
- * from POST to GET for the subsequent request. If this behavior is
377
- * undesired, the 307 Temporary Redirect status code can be used instead.
378
- *
379
- * A 301 response is cacheable by default; i.e., unless otherwise indicated
380
- * by the method definition or explicit cache controls.
381
- */
382
- 301: 'Moved Permanently',
383
- /**
384
- * The target resource resides temporarily under a different URI. Since the
385
- * redirection might be altered on occasion, the client ought to continue to
386
- * use the effective request URI for future requests.
387
- *
388
- * The server SHOULD generate a Location header field in the response
389
- * containing a URI reference for the different URI. The user agent MAY use
390
- * the Location field value for automatic redirection. The server's response
391
- * payload usually contains a short hypertext note with a hyperlink to the
392
- * different URI(s).
393
- *
394
- * Note: For historical reasons, a user agent MAY change the request method
395
- * from POST to GET for the subsequent request. If this behavior is
396
- * undesired, the 307 Temporary Redirect status code can be used instead.
397
- */
398
- 302: 'Found',
399
- /**
400
- * The server is redirecting the user agent to a different resource, as
401
- * indicated by a URI in the Location header field, which is intended to
402
- * provide an indirect response to the original request.
403
- *
404
- * A user agent can perform a retrieval request targeting that URI (a GET or
405
- * HEAD request if using HTTP), which might also be redirected, and present
406
- * the eventual result as an answer to the original request. Note that the
407
- * new URI in the Location header field is not considered equivalent to the
408
- * effective request URI.
409
- *
410
- * This status code is applicable to any HTTP method. It is primarily used
411
- * to allow the output of a POST action to redirect the user agent to a
412
- * selected resource, since doing so provides the information corresponding
413
- * to the POST response in a form that can be separately identified,
414
- * bookmarked, and cached, independent of the original request.
415
- *
416
- * A 303 response to a GET request indicates that the origin server does not
417
- * have a representation of the target resource that can be transferred by
418
- * the server over HTTP. However, the Location field value refers to a
419
- * resource that is descriptive of the target resource, such that making a
420
- * retrieval request on that other resource might result in a representation
421
- * that is useful to recipients without implying that it represents the
422
- * original target resource. Note that answers to the questions of what can
423
- * be represented, what representations are adequate, and what might be a
424
- * useful description are outside the scope of HTTP.
425
- *
426
- * Except for responses to a HEAD request, the representation of a 303
427
- * response ought to contain a short hypertext note with a hyperlink to the
428
- * same URI reference provided in the Location header field.
429
- */
430
- 303: 'See Other',
431
- /**
432
- * A conditional GET or HEAD request has been received and would have
433
- * resulted in a 200 OK response if it were not for the fact that the
434
- * condition evaluated to false.
435
- *
436
- * In other words, there is no need for the server to transfer a
437
- * representation of the target resource because the request indicates that
438
- * the client, which made the request conditional, already has a valid
439
- * representation; the server is therefore redirecting the client to make
440
- * use of that stored representation as if it were the payload of a 200 OK
441
- * response.
442
- *
443
- * The server generating a 304 response MUST generate any of the following
444
- * header fields that would have been sent in a 200 OK response to the same
445
- * request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary.
446
- *
447
- * Since the goal of a 304 response is to minimize information transfer when
448
- * the recipient already has one or more cached representations, a sender
449
- * SHOULD NOT generate representation metadata other than the above listed
450
- * fields unless said metadata exists for the purpose of guiding cache
451
- * updates (e.g., Last-Modified might be useful if the response does not have
452
- * an ETag field).
453
- *
454
- * Requirements on a cache that receives a 304 response are defined in
455
- * Section 4.3.4 of RFC7234. If the conditional request originated with an
456
- * outbound client, such as a user agent with its own cache sending a
457
- * conditional GET to a shared proxy, then the proxy SHOULD forward the
458
- * 304 response to that client.
459
- *
460
- * A 304 response cannot contain a message-body; it is always terminated by
461
- * the first empty line after the header fields.
462
- */
463
- 304: 'Not Modified',
464
- /**
465
- * Defined in a previous version of this specification and is now deprecated,
466
- * due to security concerns regarding in-band configuration of a proxy.
467
- */
468
- 305: 'Use Proxy',
469
- /**
470
- * The target resource resides temporarily under a different URI and the user
471
- * agent MUST NOT change the request method if it performs an automatic
472
- * redirection to that URI.
473
- *
474
- * Since the redirection can change over time, the client ought to continue
475
- * using the original effective request URI for future requests.
476
- *
477
- * The server SHOULD generate a Location header field in the response
478
- * containing a URI reference for the different URI. The user agent MAY use
479
- * the Location field value for automatic redirection. The server's response
480
- * payload usually contains a short hypertext note with a hyperlink to the
481
- * different URI(s).
482
- *
483
- * Note: This status code is similar to 302 Found, except that it does not
484
- * allow changing the request method from POST to GET. This specification
485
- * defines no equivalent counterpart for 301 Moved Permanently (RFC7238,
486
- * however, proposes defining the status code 308 Permanent Redirect for
487
- * this purpose).
488
- */
489
- 307: 'Temporary Redirect',
490
- /**
491
- * The target resource has been assigned a new permanent URI and any future
492
- * references to this resource ought to use one of the enclosed URIs.
493
- *
494
- * Clients with link editing capabilities ought to automatically re-link
495
- * references to the effective request URI to one or more of the new
496
- * references sent by the server, where possible.
497
- *
498
- * The server SHOULD generate a Location header field in the response
499
- * containing a preferred URI reference for the new permanent URI. The user
500
- * agent MAY use the Location field value for automatic redirection. The
501
- * server's response payload usually contains a short hypertext note with a
502
- * hyperlink to the new URI(s).
503
- *
504
- * A 308 response is cacheable by default; i.e., unless otherwise indicated
505
- * by the method definition or explicit cache controls.
506
- *
507
- * Note: This status code is similar to 301 Moved Permanently, except that it
508
- * does not allow changing the request method from POST to GET.
509
- */
510
- 308: 'Permanent Redirect',
511
- /**
512
- * The 400 (Bad Request) status code indicates that the server cannot or
513
- * will not process the request due to something that is perceived to be
514
- * a client error (e.g., malformed request syntax, invalid request
515
- * message framing, or deceptive request routing).
516
- */
517
- 400: 'Bad Request',
518
- /**
519
- * The request has not been applied because it lacks valid authentication
520
- * credentials for the target resource.
521
- *
522
- * The server generating a 401 response MUST send a WWW-Authenticate header
523
- * field containing at least one challenge applicable to the target resource.
524
- *
525
- * If the request included authentication credentials, then the 401 response
526
- * indicates that authorization has been refused for those credentials. The
527
- * user agent MAY repeat the request with a new or replaced Authorization
528
- * header field. If the 401 response contains the same challenge as the
529
- * prior response, and the user agent has already attempted authentication at
530
- * least once, then the user agent SHOULD present the enclosed representation
531
- * to the user, since it usually contains relevant diagnostic information.
532
- */
533
- 401: 'Unauthorized',
534
- /**
535
- * The 402 (Payment Required) status code is reserved for future use.
536
- */
537
- 402: 'Payment Required',
538
- /**
539
- * The 403 (Forbidden) status code indicates that the server understood
540
- * the request but refuses to authorize it. A server that wishes to
541
- * make public why the request has been forbidden can describe that
542
- * reason in the response payload (if any).
543
- *
544
- * If authentication credentials were provided in the request, the
545
- * server considers them insufficient to grant access. The client
546
- * SHOULD NOT automatically repeat the request with the same
547
- * credentials. The client MAY repeat the request with new or different
548
- * credentials. However, a request might be forbidden for reasons
549
- * unrelated to the credentials.
550
- *
551
- * An origin server that wishes to "hide" the current existence of a
552
- * forbidden target resource MAY instead respond with a status code of
553
- * 404 (Not Found).
554
- */
555
- 403: 'Forbidden',
556
- /**
557
- * The 404 (Not Found) status code indicates that the origin server did
558
- * not find a current representation for the target resource or is not
559
- * willing to disclose that one exists. A 404 status code does not
560
- * indicate whether this lack of representation is temporary or
561
- * permanent; the 410 (Gone) status code is preferred over 404 if the
562
- * origin server knows, presumably through some configurable means, that
563
- * the condition is likely to be permanent.
564
- *
565
- * A 404 response is cacheable by default; i.e., unless otherwise
566
- * indicated by the method definition or explicit cache controls (see
567
- * Section 4.2.2 of [RFC7234]).
568
- */
569
- 404: 'Not Found',
570
- /**
571
- * The 405 (Method Not Allowed) status code indicates that the method
572
- * received in the request-line is known by the origin server but not
573
- * supported by the target resource. The origin server MUST generate an
574
- * Allow header field in a 405 response containing a list of the target
575
- * resource's currently supported methods.
576
- *
577
- * A 405 response is cacheable by default; i.e., unless otherwise
578
- * indicated by the method definition or explicit cache controls (see
579
- * Section 4.2.2 of [RFC7234]).
580
- */
581
- 405: 'Method Not Allowed',
582
- /**
583
- * The 406 (Not Acceptable) status code indicates that the target
584
- * resource does not have a current representation that would be
585
- * acceptable to the user agent, according to the proactive negotiation
586
- * header fields received in the request (Section 5.3), and the server
587
- * is unwilling to supply a default representation.
588
- *
589
- * The server SHOULD generate a payload containing a list of available
590
- * representation characteristics and corresponding resource identifiers
591
- * from which the user or user agent can choose the one most
592
- * appropriate. A user agent MAY automatically select the most
593
- * appropriate choice from that list. However, this specification does
594
- * not define any standard for such automatic selection, as described in
595
- * Section 6.4.1 of [RFC7231]
596
- */
597
- 406: 'Not Acceptable',
598
- /**
599
- * Similar to 401 Unauthorized, but it indicates that the client needs to
600
- * authenticate itself in order to use a proxy.
601
- *
602
- * The proxy MUST send a Proxy-Authenticate header field containing a
603
- * challenge applicable to that proxy for the target resource. The client MAY
604
- * repeat the request with a new or replaced Proxy-Authorization header field.
605
- */
606
- 407: 'Proxy Authentication Required',
607
- /**
608
- * The 408 (Request Timeout) status code indicates that the server did
609
- * not receive a complete request message within the time that it was
610
- * prepared to wait. A server SHOULD send the "close" connection option
611
- * (Section 6.1 of [RFC7230]) in the response, since 408 implies that
612
- * the server has decided to close the connection rather than continue
613
- * waiting. If the client has an outstanding request in transit, the
614
- * client MAY repeat that request on a new connection.
615
- */
616
- 408: 'Request Timeout',
617
- /**
618
- * The 409 (Conflict) status code indicates that the request could not
619
- * be completed due to a conflict with the current state of the target
620
- * resource. This code is used in situations where the user might be
621
- * able to resolve the conflict and resubmit the request. The server
622
- * SHOULD generate a payload that includes enough information for a user
623
- * to recognize the source of the conflict.
624
- *
625
- * Conflicts are most likely to occur in response to a PUT request. For
626
- * example, if versioning were being used and the representation being
627
- * PUT included changes to a resource that conflict with those made by
628
- * an earlier (third-party) request, the origin server might use a 409
629
- * response to indicate that it can't complete the request. In this
630
- * case, the response representation would likely contain information
631
- * useful for merging the differences based on the revision history.
632
- */
633
- 409: 'Conflict',
634
- /**
635
- * The 410 (Gone) status code indicates that access to the target
636
- * resource is no longer available at the origin server and that this
637
- * condition is likely to be permanent. If the origin server does not
638
- * know, or has no facility to determine, whether or not the condition
639
- * is permanent, the status code 404 (Not Found) ought to be used
640
- * instead.
641
- *
642
- * The 410 response is primarily intended to assist the task of web
643
- * maintenance by notifying the recipient that the resource is
644
- * intentionally unavailable and that the server owners desire that
645
- * remote links to that resource be removed. Such an event is common
646
- * for limited-time, promotional services and for resources belonging to
647
- * individuals no longer associated with the origin server's site. It
648
- * is not necessary to mark all permanently unavailable resources as
649
- * "gone" or to keep the mark for any length of time -- that is left to
650
- * the discretion of the server owner.
651
- *
652
- * A 410 response is cacheable by default; i.e., unless otherwise
653
- * indicated by the method definition or explicit cache controls (see
654
- * Section 4.2.2 of [RFC7234]).
655
- */
656
- 410: 'Gone',
657
- /**
658
- * The 411 (Length Required) status code indicates that the server
659
- * refuses to accept the request without a defined Content-Length
660
- * (Section 3.3.2 of [RFC7230]). The client MAY repeat the request if
661
- * it adds a valid Content-Length header field containing the length of
662
- * the message body in the request message.
663
- */
664
- 411: 'Length Required',
665
- /**
666
- * One or more conditions given in the request header fields evaluated to
667
- * false when tested on the server.
668
- *
669
- * This response code allows the client to place preconditions on the current
670
- * resource state (its current representations and metadata) and, thus,
671
- * prevent the request method from being applied if the target resource is in
672
- * an unexpected state.
673
- */
674
- 412: 'Precondition Failed',
675
- /**
676
- * The 413 (Payload Too Large) status code indicates that the server is
677
- * refusing to process a request because the request payload is larger
678
- * than the server is willing or able to process. The server MAY close
679
- * the connection to prevent the client from continuing the request.
680
- *
681
- * If the condition is temporary, the server SHOULD generate a
682
- * Retry-After header field to indicate that it is temporary and after
683
- * what time the client MAY try again.
684
- */
685
- 413: 'Payload Too Large',
686
- /**
687
- * The 414 (URI Too Long) status code indicates that the server is
688
- * refusing to service the request because the request-target (Section
689
- * 5.3 of [RFC7230]) is longer than the server is willing to interpret.
690
- * This rare condition is only likely to occur when a client has
691
- * improperly converted a POST request to a GET request with long query
692
- * information, when the client has descended into a "black hole" of
693
- * redirection (e.g., a redirected URI prefix that points to a suffix of
694
- * itself) or when the server is under attack by a client attempting to
695
- * exploit potential security holes.
696
- *
697
- * A 414 response is cacheable by default; i.e., unless otherwise
698
- * indicated by the method definition or explicit cache controls (see
699
- * Section 4.2.2 of [RFC7234]).
700
- */
701
- 414: 'Request-URI Too Long',
702
- /**
703
- * The 415 (Unsupported Media Type) status code indicates that the
704
- * origin server is refusing to service the request because the payload
705
- * is in a format not supported by this method on the target resource.
706
- * The format problem might be due to the request's indicated
707
- * Content-Type or Content-Encoding, or as a result of inspecting the
708
- * data directly.
709
- */
710
- 415: 'Unsupported Media Type',
711
- /**
712
- * None of the ranges in the request's Range header field overlap the
713
- * current extent of the selected resource or that the set of ranges
714
- * requested has been rejected due to invalid ranges or an excessive request
715
- * of small or overlapping ranges.
716
- *
717
- * For byte ranges, failing to overlap the current extent means that the
718
- * first-byte-pos of all of the byte-range-spec values were greater than the
719
- * current length of the selected representation. When this status code is
720
- * generated in response to a byte-range request, the sender SHOULD generate
721
- * a Content-Range header field specifying the current length of the selected
722
- * representation
723
- */
724
- 416: 'Requested Range Not Satisfiable',
725
- /**
726
- * The 417 (Expectation Failed) status code indicates that the
727
- * expectation given in the request's Expect header field
728
- * (Section 5.1.1 of [RFC7231]) could not be met by at least one of the
729
- * inbound servers.
730
- */
731
- 417: 'Expectation Failed',
732
- /**
733
- * Any attempt to brew coffee with a teapot should result in the error code
734
- * "418 I'm a teapot". The resulting entity body MAY be short and stout.
735
- */
736
- 418: "I'm a Teapot",
737
- /**
738
- * The request was directed at a server that is not able to produce a
739
- * response. This can be sent by a server that is not configured to produce
740
- * responses for the combination of scheme and authority that are included
741
- * in the request URI.
742
- *
743
- * Clients receiving a 421 Misdirected Request response from a server MAY
744
- * retry the request -- whether the request method is idempotent or
745
- * not -- over a different connection. This is possible if a connection is
746
- * reused or if an alternative service is selected ALT-SVC.
747
- *
748
- * This status code MUST NOT be generated by proxies.
749
- *
750
- * A 421 response is cacheable by default, i.e., unless otherwise indicated by
751
- * the method definition or explicit cache controls
752
- */
753
- 421: 'Misdirected Request',
754
- /**
755
- * The server understands the content type of the request entity (hence a
756
- * 415 Unsupported Media Type status code is inappropriate), and the syntax
757
- * of the request entity is correct (thus a 400 Bad Request status code is
758
- * inappropriate) but was unable to process the contained instructions.
759
- *
760
- * For example, this error condition may occur if an XML request body contains
761
- * well-formed (i.e., syntactically correct), but semantically erroneous, XML
762
- * instructions.
763
- */
764
- 422: 'Unprocessable Entity',
765
- /**
766
- * The source or destination resource of a method is locked.
767
- *
768
- * This response SHOULD contain an appropriate precondition or postcondition
769
- * code, such as 'lock-token-submitted' or 'no-conflicting-lock'.
770
- */
771
- 423: 'Locked',
772
- /**
773
- * The method could not be performed on the resource because the requested
774
- * action depended on another action and that action failed.
775
- *
776
- * For example, if a command in a PROPPATCH method fails, then, at minimum,
777
- * the rest of the commands will also fail with 424 Failed Dependency.
778
- */
779
- 424: 'Failed Dependency',
780
- /**
781
- * The 426 (Upgrade Required) status code indicates that the server
782
- * refuses to perform the request using the current protocol but might
783
- * be willing to do so after the client upgrades to a different
784
- * protocol. The server MUST send an Upgrade header field in a 426
785
- * response to indicate the required protocol(s) (Section 6.7 of
786
- * [RFC7230]).
787
- */
788
- 426: 'Upgrade Required',
789
- /**
790
- * The origin server requires the request to be conditional.
791
- *
792
- * Its typical use is to avoid the "lost update" problem, where a client GETs
793
- * a resource's state, modifies it, and PUTs it back to the server, when
794
- * meanwhile a third party has modified the state on the server, leading
795
- * to a conflict. By requiring requests to be conditional, the server can
796
- * assure that clients are working with the correct copies.
797
- *
798
- * Responses using this status code SHOULD explain how to resubmit the request
799
- * successfully.
800
- *
801
- * Responses with the 428 status code MUST NOT be stored by a cache.
802
- */
803
- 428: 'Precondition Required',
804
- /**
805
- * The user has sent too many requests in a given amount of time
806
- * ("rate limiting").
807
- *
808
- * The response representations SHOULD include details explaining the
809
- * condition, and MAY include a Retry-After header indicating how long to
810
- * wait before making a new request.
811
- *
812
- * Responses with the 429 status code MUST NOT be stored by a cache.
813
- */
814
- 429: 'Too Many Requests',
815
- /**
816
- * The server is unwilling to process the request because its header fields
817
- * are too large. The request MAY be resubmitted after reducing the size of
818
- * the request header fields.
819
- *
820
- * It can be used both when the set of request header fields in total is too
821
- * large, and when a single header field is at fault. In the latter case, the
822
- * response representation SHOULD specify which header field was too large.
823
- */
824
- 431: 'Request Header Fields Too Large',
825
- /**
826
- * A non-standard status code used to instruct nginx to close the connection
827
- * without sending a response to the client, most commonly used to deny
828
- * malicious or malformed requests.
829
- *
830
- * This status code is not seen by the client, it only appears in nginx log
831
- * files.
832
- */
833
- 444: 'Connection Closed Without Response',
834
- /**
835
- * The server is denying access to the resource as a consequence of a legal
836
- * demand.
837
- *
838
- * The server in question might not be an origin server. This type of legal
839
- * demand typically most directly affects the operations of ISPs and search
840
- * engines.
841
- *
842
- * Responses using this status code SHOULD include an explanation, in the
843
- * response body, of the details of the legal demand: the party making it,
844
- * the applicable legislation or regulation, and what classes of person and
845
- * resource it applies to.
846
- *
847
- * The use of the 451 status code implies neither the existence nor
848
- * non-existence of the resource named in the request. That is to say, it is
849
- * possible that if the legal demands were removed, a request for the
850
- * resource still might not succeed.
851
- *
852
- * Note that in many cases clients can still access the denied resource by
853
- * using technical countermeasures such as a VPN or the Tor network.
854
- *
855
- * A 451 response is cacheable by default; i.e., unless otherwise indicated
856
- * by the method definition or explicit cache controls; see RFC7234.
857
- */
858
- 451: 'Unavailable For Legal Reasons',
859
- /**
860
- * A non-standard status code introduced by nginx for the case when a client
861
- * closes the connection while nginx is processing the request.
862
- */
863
- 499: 'Client Closed Request',
864
- /**
865
- * The 500 (Internal Server Error) status code indicates that the server
866
- * encountered an unexpected condition that prevented it from fulfilling
867
- * the request.
868
- */
869
- 500: 'Internal Server Error',
870
- /**
871
- * The 501 (Not Implemented) status code indicates that the server does
872
- * not support the functionality required to fulfill the request. This
873
- * is the appropriate response when the server does not recognize the
874
- * request method and is not capable of supporting it for any resource.
875
- *
876
- * A 501 response is cacheable by default; i.e., unless otherwise
877
- * indicated by the method definition or explicit cache controls (see
878
- * Section 4.2.2 of [RFC7234]).
879
- */
880
- 501: 'Not Implemented',
881
- /**
882
- * The 502 (Bad Gateway) status code indicates that the server, while
883
- * acting as a gateway or proxy, received an invalid response from an
884
- * inbound server it accessed while attempting to fulfill the request.
885
- */
886
- 502: 'Bad Gateway',
887
- /**
888
- * The 503 (Service Unavailable) status code indicates that the server
889
- * is currently unable to handle the request due to a temporary overload
890
- * or scheduled maintenance, which will likely be alleviated after some
891
- * delay. The server MAY send a Retry-After header field
892
- * (Section 7.1.3 of [RFC7231]) to suggest an appropriate amount of time for
893
- * the client to wait before retrying the request.
894
- */
895
- 503: 'Service Unavailable',
896
- /**
897
- * The 504 (Gateway Timeout) status code indicates that the server,
898
- *while acting as a gateway or proxy, did not receive a timely response
899
- *from an upstream server it needed to access in order to complete the
900
- *request.
901
- */
902
- 504: 'Gateway Timeout',
903
- /**
904
- * The 505 (HTTP Version Not Supported) status code indicates that the
905
- *server does not support, or refuses to support, the major version of
906
- *HTTP that was used in the request message. The server is indicating
907
- *that it is unable or unwilling to complete the request using the same
908
- *major version as the client, as described in Section 2.6 of
909
- *[RFC7230], other than with this error message. The server SHOULD
910
- *generate a representation for the 505 response that describes why
911
- *that version is not supported and what other protocols are supported
912
- *by that server.
913
- */
914
- 505: 'HTTP Version Not Supported',
915
- /**
916
- * The server has an internal configuration error: the chosen variant
917
- * resource is configured to engage in transparent content negotiation
918
- * itself, and is therefore not a proper end point in the negotiation
919
- * process.
920
- */
921
- 506: 'Variant Also Negotiates',
922
- /**
923
- * The method could not be performed on the resource because the server is
924
- * unable to store the representation needed to successfully complete the
925
- * request.
926
- *
927
- * This condition is considered to be temporary. If the request that received
928
- * this status code was the result of a user action, the request MUST NOT be
929
- * repeated until it is requested by a separate user action.
930
- */
931
- 507: 'Insufficient Storage',
932
- /**
933
- * The server terminated an operation because it encountered an infinite loop
934
- * while processing a request with "Depth: infinity". This status indicates
935
- * that the entire operation failed.
936
- */
937
- 508: 'Loop Detected',
938
- /**
939
- * The policy for accessing the resource has not been met in the request. The
940
- * server should send back all the information necessary for the client to
941
- * issue an extended request.
942
- *
943
- * It is outside the scope of this specification to specify how the
944
- * extensions inform the client.
945
- *
946
- * If the 510 response contains information about extensions that were not
947
- * present in the initial request then the client MAY repeat the request if
948
- * it has reason to believe it can fulfill the extension policy by modifying
949
- * the request according to the information provided in the 510 response.
950
- * Otherwise the client MAY present any entity included in the 510 response
951
- * to the user, since that entity may include relevant diagnostic information.
952
- */
953
- 510: 'Not Extended',
954
- /**
955
- * The client needs to authenticate to gain network access.
956
- *
957
- * The response representation SHOULD contain a link to a resource that
958
- * allows the user to submit credentials (e.g., with an HTML form).
959
- *
960
- * Note that the 511 response SHOULD NOT contain a challenge or the login
961
- * interface itself, because browsers would show the login interface as being
962
- * associated with the originally requested URL, which may cause confusion.
963
- *
964
- * The 511 status SHOULD NOT be generated by origin servers; it is intended
965
- * for use by intercepting proxies that are interposed as a means of
966
- * controlling access to the network.
967
- *
968
- * Responses with the 511 status code MUST NOT be stored by a cache.
969
- */
970
- 511: 'Network Authentication Required',
971
- /**
972
- * This status code is not specified in any RFCs, but is used by some HTTP
973
- * proxies to signal a network connect timeout behind the proxy to a client
974
- * in front of the proxy.
975
- */
976
- 599: 'Network Connect Timeout Error'
977
- };
978
- /**
979
- * Checks if the given numerical status code is in the known HTTP status codes
980
- * list.
981
- *
982
- * @param code HTTP Status code
983
- * @returns True if the code is a valid HTTP status code
984
- */
985
- export const isValidStatusCode = (code) => !!HTTPStatuses[code];
986
- /**
987
- * Checks if the given status code is in the informational range (1XX).
988
- *
989
- * @param code HTTP Status code
990
- * @returns True if the code is in the "informational" range.
991
- */
992
- export const isInformational = (code) => code >= 100 && code < 200;
993
- /**
994
- * Checks if the given status code is in the successful range (2XX).
995
- *
996
- * @param code HTTP Status code
997
- * @returns True if the code is in the "success" range.
998
- */
999
- export const isSuccessful = (code) => code >= 200 && code < 300;
1000
- /**
1001
- * Checks if the given status code is in the redirection range (3XX).
1002
- *
1003
- * @param code HTTP Status code
1004
- * @returns True if the code is in the "redirection" range.
1005
- */
1006
- export const isRedirection = (code) => code >= 300 && code < 400;
1007
- /**
1008
- * Checks if the given status code is in the client error range (4XX).
1009
- *
1010
- * @param code HTTP Status code
1011
- * @returns True if the code is in the "client error" range.
1012
- */
1013
- export const isClientError = (code) => code >= 400 && code < 500;
1014
- /**
1015
- * Checks if the given status code is in the server error range (5XX).
1016
- *
1017
- * @param code HTTP Status code
1018
- * @returns True if the code is in the "server error" range.
1019
- */
1020
- export const isServerError = (code) => code >= 500;
1021
- /**
1022
- * Searches the list of HTTP statuses for a matching textual name to the one
1023
- * provided. If a match is found, then the numerical status code is returned,
1024
- * otherwise `null`.
1025
- *
1026
- * Internally, the parameter and the status names are normalized by lower-casing
1027
- * the strings and trimming space.
1028
- *
1029
- * @param status HTTP Status textual name
1030
- * @returns The numerical status code, or null if not found
1031
- */
1032
- export const getCodeForStatus = (status) => {
1033
- const clnStr = status.toLocaleLowerCase().trim();
1034
- const entry = Object.entries(HTTPStatuses).find((ent) => ent[1].toLowerCase() === clnStr);
1035
- if (entry)
1036
- return parseInt(entry[0]);
1037
- return null;
1038
- };
1039
- export default HTTPStatuses;