【问题标题】:Unknown Format exception with text/plain,text/html; Accept headertext/plain,text/html 的未知格式异常;接受标头
【发布时间】:2015-09-24 12:28:30
【问题描述】:

接受标头"Accept: text/plain,text/html;" 适用于http://nginx.org 等网站。但是,当我针对我的 Rails 4.1 应用程序在本地运行它时

curl -v -H "Accept: text/plain,text/html;" localhost:3000/

在 html 响应主页上,我收到一个 500 错误页面,用于执行 ActionController::UnknownFormat 执行。

当我卷曲时

curl -v -H "Accept: text/plain,text/html" localhost:3000

一切正常(注意缺少;

我怎样才能使它也适用于Accept: text/plain,text/html; 案例?

【问题讨论】:

    标签: ruby-on-rails mime-types ruby-on-rails-4.1


    【解决方案1】:

    显然,根据 RFC 7231,它的格式不正确,不应该工作。即使对于明显格式错误的 MIME 类型,nginx.org 也会返回 200 OK

    另见https://github.com/rails/rails/issues/21749

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-15
      • 2021-02-28
      • 2021-08-04
      • 2016-03-10
      • 1970-01-01
      • 2012-05-19
      • 2011-12-10
      相关资源
      最近更新 更多