|
24 | 24 | 101: "101 Switching Protocols", |
25 | 25 | 102: "102 Processing", |
26 | 26 | 103: "103 Early Hints", |
| 27 | + |
27 | 28 | # 2xx: Success |
28 | 29 | 200: "200 OK", |
29 | 30 | 201: "201 Created", |
|
35 | 36 | 207: "207 Multi-Status", |
36 | 37 | 208: "208 Already Reported", |
37 | 38 | 226: "226 IM Used", |
| 39 | + |
38 | 40 | # 3xx: Redirection |
39 | 41 | 300: "300 Multiple Choices", |
40 | 42 | 301: "301 Moved Permanently", |
|
44 | 46 | 305: "305 Use Proxy", |
45 | 47 | 307: "307 Temporary Redirect", |
46 | 48 | 308: "308 Permanent Redirect", |
| 49 | + |
47 | 50 | # 4xx: Client Error |
48 | 51 | 400: "400 Bad Request", |
49 | 52 | 401: "401 Unauthorized", |
|
74 | 77 | 429: "429 Too Many Requests", |
75 | 78 | 431: "431 Request Header Fields Too Large", |
76 | 79 | 451: "451 Unavailable For Legal Reasons", |
| 80 | + |
77 | 81 | # 5xx: Server Error |
78 | 82 | 500: "500 Internal Server Error", |
79 | 83 | 501: "501 Not Implemented", |
|
87 | 91 | 510: "510 Not Extended", |
88 | 92 | 511: "511 Network Authentication Required", |
89 | 93 | } |
90 | | - |
91 | | -ERROR_CONVENTIONS = { |
92 | | - # 4xx — Client Errors |
93 | | - 400: {"code": "BAD_REQUEST", "message": "Invalid request."}, |
94 | | - 401: {"code": "UNAUTHORIZED", "message": "Authentication required or invalid."}, |
95 | | - 402: {"code": "PAYMENT_REQUIRED", "message": "Payment required."}, |
96 | | - 403: { |
97 | | - "code": "FORBIDDEN", |
98 | | - "message": "You do not have permission to perform this action.", |
99 | | - }, |
100 | | - 404: {"code": "NOT_FOUND", "message": "Resource not found."}, |
101 | | - 405: { |
102 | | - "code": "METHOD_NOT_ALLOWED", |
103 | | - "message": "HTTP method not allowed for this resource.", |
104 | | - }, |
105 | | - 406: {"code": "NOT_ACCEPTABLE", "message": "Response format not acceptable."}, |
106 | | - 407: { |
107 | | - "code": "PROXY_AUTH_REQUIRED", |
108 | | - "message": "Proxy authentication is required.", |
109 | | - }, |
110 | | - 408: {"code": "REQUEST_TIMEOUT", "message": "Request timed out."}, |
111 | | - 409: { |
112 | | - "code": "CONFLICT", |
113 | | - "message": "Conflict with the current state of the resource.", |
114 | | - }, |
115 | | - 410: {"code": "GONE", "message": "Resource is no longer available."}, |
116 | | - 411: {"code": "LENGTH_REQUIRED", "message": "Content-Length header is required."}, |
117 | | - 412: {"code": "PRECONDITION_FAILED", "message": "Preconditions not met."}, |
118 | | - 413: {"code": "PAYLOAD_TOO_LARGE", "message": "Payload too large."}, |
119 | | - 414: {"code": "URI_TOO_LONG", "message": "URI too long."}, |
120 | | - 415: {"code": "UNSUPPORTED_MEDIA_TYPE", "message": "Unsupported media type."}, |
121 | | - 416: {"code": "RANGE_NOT_SATISFIABLE", "message": "Byte range not satisfiable."}, |
122 | | - 417: { |
123 | | - "code": "EXPECTATION_FAILED", |
124 | | - "message": "Expectation in header could not be met.", |
125 | | - }, |
126 | | - 418: {"code": "I_AM_A_TEAPOT", "message": "I am a teapot."}, |
127 | | - 421: { |
128 | | - "code": "MISDIRECTED_REQUEST", |
129 | | - "message": "Request directed to the wrong server.", |
130 | | - }, |
131 | | - 422: {"code": "UNPROCESSABLE_ENTITY", "message": "Invalid semantic entity."}, |
132 | | - 423: {"code": "LOCKED", "message": "Resource locked."}, |
133 | | - 424: {"code": "FAILED_DEPENDENCY", "message": "Failed dependency."}, |
134 | | - 425: {"code": "TOO_EARLY", "message": "Too early to process; try again."}, |
135 | | - 426: {"code": "UPGRADE_REQUIRED", "message": "Protocol upgrade required."}, |
136 | | - 428: {"code": "PRECONDITION_REQUIRED", "message": "Precondition required."}, |
137 | | - 429: { |
138 | | - "code": "TOO_MANY_REQUESTS", |
139 | | - "message": "Too many requests; try again later.", |
140 | | - }, |
141 | | - 431: { |
142 | | - "code": "REQUEST_HEADER_FIELDS_TOO_LARGE", |
143 | | - "message": "Request header fields too large.", |
144 | | - }, |
145 | | - 451: { |
146 | | - "code": "UNAVAILABLE_FOR_LEGAL_REASONS", |
147 | | - "message": "Unavailable for legal reasons.", |
148 | | - }, |
149 | | - # 5xx — Server Errors |
150 | | - 500: {"code": "INTERNAL_ERROR", "message": "Internal error. Please try again."}, |
151 | | - 501: {"code": "NOT_IMPLEMENTED", "message": "Functionality not implemented."}, |
152 | | - 502: {"code": "BAD_GATEWAY", "message": "Bad gateway."}, |
153 | | - 503: { |
154 | | - "code": "SERVICE_UNAVAILABLE", |
155 | | - "message": "Service unavailable. Please try again later.", |
156 | | - }, |
157 | | - 504: {"code": "GATEWAY_TIMEOUT", "message": "Gateway timeout."}, |
158 | | - 505: { |
159 | | - "code": "HTTP_VERSION_NOT_SUPPORTED", |
160 | | - "message": "HTTP version not supported.", |
161 | | - }, |
162 | | - 506: {"code": "VARIANT_ALSO_NEGOTIATES", "message": "Content negotiation failed."}, |
163 | | - 507: {"code": "INSUFFICIENT_STORAGE", "message": "Insufficient storage."}, |
164 | | - 508: {"code": "LOOP_DETECTED", "message": "Loop detected during processing."}, |
165 | | - 510: {"code": "NOT_EXTENDED", "message": "Policy extensions required."}, |
166 | | - 511: { |
167 | | - "code": "NETWORK_AUTH_REQUIRED", |
168 | | - "message": "Network authentication required.", |
169 | | - }, |
170 | | -} |
0 commit comments