2 * Hypertext Transfer Protocol (HTTP) response status codes.
3 * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
5 * WebDAV and other codes useless with regards to PeerTube are not listed.
7 export enum HttpStatusCode {
10 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1
12 * The server has received the request headers and the client should proceed to send the request body
13 * (in the case of a request for which a body needs to be sent; for example, a POST request).
14 * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
15 * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
16 * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates
17 * the request should not be continued.
22 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2
24 * This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too.
26 SWITCHING_PROTOCOLS_101 = 101,
29 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1
31 * Standard response for successful HTTP requests. The actual response will depend on the request method used:
32 * GET: The resource has been fetched and is transmitted in the message body.
33 * HEAD: The entity headers are in the message body.
34 * POST: The resource describing the result of the action is transmitted in the message body.
35 * TRACE: The message body contains the request message as received by the server
40 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2
42 * The request has been fulfilled, resulting in the creation of a new resource, typically after a PUT.
47 * The request has been accepted for processing, but the processing has not been completed.
48 * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
53 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5
55 * There is no content to send for this request, but the headers may be useful.
56 * The user-agent may update its cached headers for this resource with the new ones.
61 * The server successfully processed the request, but is not returning any content.
62 * Unlike a 204 response, this response requires that the requester reset the document view.
64 RESET_CONTENT_205 = 205,
67 * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
68 * The range header is used by HTTP clients to enable resuming of interrupted downloads,
69 * or split a download into multiple simultaneous streams.
71 PARTIAL_CONTENT_206 = 206,
74 * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
75 * For example, this code could be used to present multiple video format options,
76 * to list files with different filename extensions, or to suggest word-sense disambiguation.
78 MULTIPLE_CHOICES_300 = 300,
81 * This and all future requests should be directed to the given URI.
83 MOVED_PERMANENTLY_301 = 301,
86 * This is an example of industry practice contradicting the standard.
87 * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
88 * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
89 * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
90 * to distinguish between the two behaviours. However, some Web applications and frameworks
91 * use the 302 status code as if it were the 303.
97 * The response to the request can be found under another URI using a GET method.
98 * When received in response to a POST (or PUT/DELETE), the client should presume that
99 * the server has received the data and should issue a redirect with a separate GET message.
104 * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1
106 * Indicates that the resource has not been modified since the version specified by the request headers
107 * `If-Modified-Since` or `If-None-Match`.
108 * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
110 NOT_MODIFIED_304 = 304,
114 * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
115 * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the
117 * For example, a POST request should be repeated using another POST request.
119 TEMPORARY_REDIRECT_307 = 307,
122 * The request and all future requests should be repeated using another URI.
123 * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
124 * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
126 PERMANENT_REDIRECT_308 = 308,
129 * The server cannot or will not process the request due to an apparent client error
130 * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
132 BAD_REQUEST_400 = 400,
135 * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1
137 * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
138 * been provided. The response must include a `WWW-Authenticate` header field containing a challenge applicable to the
139 * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
140 * "unauthenticated",i.e. the user does not have the necessary credentials.
142 UNAUTHORIZED_401 = 401,
145 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2
147 * Reserved for future use. The original intention was that this code might be used as part of some form of digital
148 * cash or micro payment scheme, but that has not happened, and this code is not usually used.
149 * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
151 PAYMENT_REQUIRED_402 = 402,
154 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3
156 * The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to
157 * give proper response. Unlike 401, the client's identity is known to the server.
162 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2
164 * The requested resource could not be found but may be available in the future.
165 * Subsequent requests by the client are permissible.
170 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5
172 * A request method is not supported for the requested resource;
173 * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
175 METHOD_NOT_ALLOWED_405 = 405,
178 * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
180 NOT_ACCEPTABLE_406 = 406,
183 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7
185 * This response is sent on an idle connection by some servers, even without any previous request by the client.
186 * It means that the server would like to shut down this unused connection. This response is used much more since
187 * some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also
188 * note that some servers merely shut down the connection without sending this message.
192 REQUEST_TIMEOUT_408 = 408,
195 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8
197 * Indicates that the request could not be processed because of conflict in the request,
198 * such as an edit conflict between multiple simultaneous updates.
203 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9
205 * Indicates that the resource requested is no longer available and will not be available again.
206 * This should be used when a resource has been intentionally removed and the resource should be purged.
207 * Upon receiving a 410 status code, the client should not request the resource in the future.
208 * Clients such as search engines should remove the resource from their indices.
209 * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
214 * The request did not specify the length of its content, which is required by the requested resource.
216 LENGTH_REQUIRED_411 = 411,
219 * The server does not meet one of the preconditions that the requester put on the request.
221 PRECONDITION_FAILED_412 = 412,
224 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11
226 * The request is larger than the server is willing or able to process ; the server might close the connection
227 * or return an Retry-After header field.
228 * Previously called "Request Entity Too Large".
230 PAYLOAD_TOO_LARGE_413 = 413,
233 * The URI provided was too long for the server to process. Often the result of too much data being encoded as a
234 * query-string of a GET request, in which case it should be converted to a POST request.
235 * Called "Request-URI Too Long" previously.
237 URI_TOO_LONG_414 = 414,
240 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13
242 * The request entity has a media type which the server or resource does not support.
243 * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
245 UNSUPPORTED_MEDIA_TYPE_415 = 415,
248 * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
249 * For example, if the client asked for a part of the file that lies beyond the end of the file.
250 * Called "Requested Range Not Satisfiable" previously.
252 RANGE_NOT_SATISFIABLE_416 = 416,
255 * The server cannot meet the requirements of the `Expect` request-header field.
257 EXPECTATION_FAILED_417 = 417,
260 * Official Documentation @ https://tools.ietf.org/html/rfc2324
262 * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
263 * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
264 * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including PeerTube instances ;-).
266 I_AM_A_TEAPOT_418 = 418,
269 * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3
271 * The request was well-formed but was unable to be followed due to semantic errors.
273 * @see HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 if the `Content-Type` was not supported.
274 * @see HttpStatusCode.BAD_REQUEST_400 if the request was not parsable (broken JSON, XML)
276 UNPROCESSABLE_ENTITY_422 = 422,
279 * Official Documentation @ https://tools.ietf.org/html/rfc4918#section-11.3
281 * The resource that is being accessed is locked. WebDAV-specific but used by some HTTP services.
283 * @deprecated use `If-Match` / `If-None-Match` instead
284 * @see {@link https://evertpot.com/http/423-locked}
289 * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4
291 * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
293 TOO_MANY_REQUESTS_429 = 429,
296 * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5
298 * The server is unwilling to process the request because either an individual header field,
299 * or all the header fields collectively, are too large.
301 REQUEST_HEADER_FIELDS_TOO_LARGE_431 = 431,
304 * Official Documentation @ https://tools.ietf.org/html/rfc7725
306 * A server operator has received a legal demand to deny access to a resource or to a set of resources
307 * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
309 UNAVAILABLE_FOR_LEGAL_REASONS_451 = 451,
312 * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
314 INTERNAL_SERVER_ERROR_500 = 500,
317 * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2
319 * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
320 * Usually this implies future availability (e.g., a new feature of a web-service API).
322 NOT_IMPLEMENTED_501 = 501,
325 * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
327 BAD_GATEWAY_502 = 502,
330 * The server is currently unavailable (because it is overloaded or down for maintenance).
331 * Generally, this is a temporary state.
333 SERVICE_UNAVAILABLE_503 = 503,
336 * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
338 GATEWAY_TIMEOUT_504 = 504,
341 * The server does not support the HTTP protocol version used in the request
343 HTTP_VERSION_NOT_SUPPORTED_505 = 505,
346 * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6
348 * The 507 (Insufficient Storage) status code means the method could not be performed on the resource because the
349 * server is unable to store the representation needed to successfully complete the request. This condition is
350 * considered to be temporary. If the request which received this status code was the result of a user action,
351 * the request MUST NOT be repeated until it is requested by a separate user action.
353 * @see HttpStatusCode.PAYLOAD_TOO_LARGE_413 for quota errors
355 INSUFFICIENT_STORAGE_507 = 507,