0.1.1 • Published 5 years ago
@smoozzy/http-statuses v0.1.1
Smoozzy HTTP Statuses
Collection of HTTP statuses as named constants
Status codes defined in:
- RFC1945 (HTTP/1.0)
- RFC2616 (HTTP/1.1)
- RFC6585 (Additional HTTP Status Codes)
- RFC7538 (Permanent Redirect)
- RFC2324 (Hyper Text Coffee Pot Control Protocol)
- RFC2518 (WebDAV)
Usage
import Api from '@smoozzy/api';
import {
STATUS_OK,
STATUS_MULTIPLE_CHOICES,
STATUS_UNPROCESSABLE_ENTITY,
} from '@smoozzy/http-statuses';
export default new Api({
validateStatus(status) {
return status >= STATUS_OK && status < STATUS_MULTIPLE_CHOICES ||
status === STATUS_UNPROCESSABLE_ENTITY;
},
});
Status codes
1xx Informational
Code | Status Text | Description |
---|---|---|
100 | Continue | Description |
101 | Switching Protocols | Description |
102 | Processing | Description |
103 | Early Hints | Description |
2xx Success
Code | Status Text | Description |
---|---|---|
200 | OK | Description |
201 | Created | Description |
202 | Accepted | Description |
203 | Non-authoritative Information | Description |
204 | No Content | Description |
205 | Reset Content | Description |
206 | Partial Content | Description |
207 | Multi-Status | Description |
208 | Already Reported | Description |
226 | IM Used | Description |
3xx Redirection
Code | Status Text | Description |
---|---|---|
300 | Multiple Choices | Description |
301 | Moved Permanently | Description |
302 | Found | Description |
303 | See Other | Description |
304 | Not Modified | Description |
305 | Use Proxy | Description |
307 | Temporary Redirect | Description |
308 | Permanent Redirect | Description |
4xx Client Error
Code | Status Text | Description |
---|---|---|
400 | Bad Request | Description |
401 | Unauthorized | Description |
402 | Payment Required | Description |
403 | Forbidden | Description |
404 | Not Found | Description |
405 | Method Not Allowed | Description |
406 | Not Acceptable | Description |
407 | Proxy Authentication Required | Description |
408 | Request Timeout | Description |
409 | Conflict | Description |
410 | Gone | Description |
411 | Length Required | Description |
412 | Precondition Failed | Description |
413 | Payload Too Large | Description |
414 | Request-URI Too Long | Description |
415 | Unsupported Media Type | Description |
416 | Requested Range Not Satisfiable | Description |
417 | Expectation Failed | Description |
418 | I'm a teapot | Description |
421 | Misdirected Request | Description |
422 | Unprocessable Entity | Description |
423 | Locked | Description |
424 | Failed Dependency | Description |
425 | Too Early | Description |
426 | Upgrade Required | Description |
428 | Precondition Required | Description |
429 | Too Many Requests | Description |
431 | Request Header Fields Too Large | Description |
444 | Connection Closed Without Response | Description |
451 | Unavailable For Legal Reasons | Description |
499 | Client Closed Request | Description |
5xx Server Error
Code | Status Text | Description |
---|---|---|
500 | Internal Server Error | Description |
501 | Not Implemented | Description |
502 | Bad Gateway | Description |
503 | Service Unavailable | Description |
504 | Gateway Timeout | Description |
505 | HTTP Version Not Supported | Description |
506 | Variant Also Negotiates | Description |
507 | Insufficient Storage | Description |
508 | Loop Detected | Description |
510 | Not Extended | Description |
511 | Network Authentication Required | Description |
599 | Network Connect Timeout Error | Description |