LoginSignup
9
9

More than 5 years have passed since last update.

Ruby で HTTP ステータスコード一覧を出力するワンライナー

Posted at
$ ruby -r rack/utils -e 'Rack::Utils::HTTP_STATUS_CODES.each_pair { |code, desc| puts "#{code} #{desc}" }'
100 Continue
101 Switching Protocols
102 Processing
200 OK
201 Created
202 Accepted
...
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported
506 Variant Also Negotiates
507 Insufficient Storage
508 Loop Detected
510 Not Extended
511 Network Authentication Required

HTTP ステータスコード一覧、Rack の Rack::Util モジュールに定数定義されている(コード該当箇所)ので、それを引っ張ってきているだけ。
peco にリダイレクトして絞り込みとかできる。

REF

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9