【问题标题】:ruby: convert http response codes to it's meaningruby:将http响应代码转换为它的含义
【发布时间】:2017-06-08 13:28:30
【问题描述】:

如何将 http 响应代码转换为 ruby​​/rails 中的含义。 我尝试了(虚构的).to_words 方法但没有成功

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

【问题讨论】:

  • 如果你有你需要的,你能接受我的回答吗?

标签: ruby-on-rails ruby rest-client http-response-codes


【解决方案1】:

试试

Rack::Utils::HTTP_STATUS_CODES[200]

【讨论】:

    猜你喜欢
    • 2010-11-15
    • 2022-01-22
    • 1970-01-01
    • 2012-04-03
    • 2016-04-13
    • 1970-01-01
    • 2014-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多