Search code examples
ruby-on-railsrubyrest-clienthttp-response-codes

ruby: convert http response codes to it's meaning


how do you convert http response codes to it's meaning in ruby/rails. I tried the (imaginary) .to_words method without success

(byebug) resp.code
201
(byebug) resp.code.to_words
"201 Created"

Solution

  • Try

    Rack::Utils::HTTP_STATUS_CODES[200]