@@ -300,20 +300,33 @@ module HTTP
300
300
end
301
301
302
302
# Returns the default status message of the given HTTP status code.
303
+ #
304
+ # Based on [Hypertext Transfer Protocol (HTTP) Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
305
+ #
306
+ # Last Updated 2017-04-14
307
+ #
308
+ # HTTP Status Codes (source: [http-status-codes-1.csv](https://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv))
309
+ #
310
+ # * 1xx: Informational - Request received, continuing process
311
+ # * 2xx: Success - The action was successfully received, understood, and accepted
312
+ # * 3xx: Redirection - Further action must be taken in order to complete the request
313
+ # * 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
314
+ # * 5xx: Server Error - The server failed to fulfill an apparently valid request
315
+ #
303
316
def self.default_status_message_for (status_code : Int ) : String
304
317
case status_code
305
318
when 100 then " Continue"
306
319
when 101 then " Switching Protocols"
307
- when 102 then " Processing" # RFC 2518 (WebDAV)
320
+ when 102 then " Processing"
308
321
when 200 then " OK"
309
322
when 201 then " Created"
310
323
when 202 then " Accepted"
311
324
when 203 then " Non-Authoritative Information"
312
325
when 204 then " No Content"
313
326
when 205 then " Reset Content"
314
327
when 206 then " Partial Content"
315
- when 207 then " Multi-Status" # RFC 2518 (WebDAV)
316
- when 208 then " Already Reported" # RFC 5842
328
+ when 207 then " Multi-Status"
329
+ when 208 then " Already Reported"
317
330
when 226 then " IM Used"
318
331
when 300 then " Multiple Choices"
319
332
when 301 then " Moved Permanently"
@@ -322,7 +335,7 @@ module HTTP
322
335
when 304 then " Not Modified"
323
336
when 305 then " Use Proxy"
324
337
when 307 then " Temporary Redirect"
325
- when 308 then " Permanent Redirect" # RFC 7238
338
+ when 308 then " Permanent Redirect"
326
339
when 400 then " Bad Request"
327
340
when 401 then " Unauthorized"
328
341
when 402 then " Payment Required"
@@ -336,32 +349,30 @@ module HTTP
336
349
when 410 then " Gone"
337
350
when 411 then " Length Required"
338
351
when 412 then " Precondition Failed"
339
- when 413 then " Request Entity Too Large"
340
- when 414 then " Request- URI Too Long"
352
+ when 413 then " Payload Too Large"
353
+ when 414 then " URI Too Long"
341
354
when 415 then " Unsupported Media Type"
342
- when 416 then " Requested Range Not Satisfiable"
355
+ when 416 then " Range Not Satisfiable"
343
356
when 417 then " Expectation Failed"
344
- when 418 then " I'm a teapot" # RFC 2324
345
357
when 421 then " Misdirected Request"
346
- when 422 then " Unprocessable Entity" # RFC 2518 (WebDAV)
347
- when 423 then " Locked" # RFC 2518 (WebDAV)
348
- when 424 then " Failed Dependency" # RFC 2518 (WebDAV)
349
- when 426 then " Upgrade Required" # RFC 2817
358
+ when 422 then " Unprocessable Entity"
359
+ when 423 then " Locked"
360
+ when 424 then " Failed Dependency"
361
+ when 426 then " Upgrade Required"
350
362
when 428 then " Precondition Required"
351
363
when 429 then " Too Many Requests"
352
364
when 431 then " Request Header Fields Too Large"
353
- when 449 then " Retry With" # unofficial Microsoft
354
365
when 451 then " Unavailable For Legal Reasons"
355
366
when 500 then " Internal Server Error"
356
367
when 501 then " Not Implemented"
357
368
when 502 then " Bad Gateway"
358
369
when 503 then " Service Unavailable"
359
370
when 504 then " Gateway Timeout"
360
371
when 505 then " HTTP Version Not Supported"
361
- when 506 then " Variant Also Negotiates" # RFC 2295
362
- when 507 then " Insufficient Storage" # RFC 2518 (WebDAV)
363
- when 509 then " Bandwidth Limit Exceeded " # unofficial
364
- when 510 then " Not Extended" # RFC 2774
372
+ when 506 then " Variant Also Negotiates"
373
+ when 507 then " Insufficient Storage"
374
+ when 508 then " Loop Detected "
375
+ when 510 then " Not Extended"
365
376
when 511 then " Network Authentication Required"
366
377
else " "
367
378
end
0 commit comments