Rails 3 集成测试失败,简单 html 请求出现 406 响应

发布于 2024-12-02 17:32:00 字数 9731 浏览 5 评论 0原文

我有一个集成测试,它向“show”操作发送一个简单的 GET 请求。当我assert_response :success时,我得到一个消息,它失败了,因为响应是406,这意味着格式是不可接受的HTTP

require 'test_helper'

class UserFlowsTest < ActionDispatch::IntegrationTest
  fixtures :continents, :countries, :types

  test "browse register order" do
    docs = make_docs
    assert_equal Doc.count, docs.length, "Docs not created properly"
    bob=new_session_as(:bob)
    bob.goes_to_home
    bob.goes_to_doc(1)
  end

  private

  module TestDSL
    def goes_to_home
      get root_url
      test_results("docs/index")
    end

    def goes_to_doc(id)
      get docs_url(id), #{:format => :html} - fails with this as well...
      y request.inspect
      p response.inspect
      test_results("docs/show")
    end

    def test_results(path)
      assert_response :success, "Checking #{path}"
      assert_template path
    end
  end #module TestDSL



  def new_session_as(person)
    new_session do |sess|
      #sess.goes_to_login
      #sess.logs_in_as(person)
      yield sess if block_given?
    end
  end

  def new_session
    open_session do |sess|
      sess.extend(TestDSL)
      yield sess if block_given?
    end
  end

end

这是 request.inspect 输出:

---“#[], \"action_dispatch.request.parameters\"=>{\"format\"=>\"1\", \"action\"=>\"index\", \"controller\"=>\"docs\"}, \"rack.session\"=>{\"origin_url\"=>\"/docs.1?format=html\", \"session_id\"=>\"6e0e0be703a2c2accf15121b1eb56668\"}, \"rack.test\"=>true, \"HTTP_ACCEPT\"=>\"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5\", \"HTTP_HOST\"=>\"www.example.com\", \"SERVER_NAME\"=>\"www.example.com\", \"rack.request.cookie_hash\"=>{\"_id_session\"=>\"BAh7ByIPb3JpZ2luX3VybCIGLyIPc2Vzc2lvbl9 pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg=--ceb0f44d2ac8df81c888e005abb7e9d1df02e802\"}, \"action_dispatch.remote_ip\"=>#, \"CONTENT_LENGTH\"=>\"0\", \"rack.url_scheme\"=>\"http\", \"action_dispatch.request.query_parameters\"=>{\"format\"=>\"html\"}, \"action_dispatch.request.unsigned_session_cookie\"=>{\"origin_url\"=>\"/\", \"session_id\"=>\"6e0e0be703a2c2accf15121b1eb56668\"}, \"CONTENT_TYPE\"=>\"application/x-www-form-urlencoded\", \"HTTPS\"=>\"关闭\", \"rack.errors\"=>#, \"action_dispatch.secret_token\"=>\"8922d5d0a3e706818581l8cc2d42d9ce584ba6350de71e 6afc49b2ad7d3d05c6e763db2615fca9eb123c51b57223d955a5199b60c20e5efb4be14888a4e3520a2\", \"REMOTE_ADDR\"=>\"127.0.0.1\", \"PATH_INFO\"=>\"/docs.1\", \"rack.version\"=>[1, 1], \"rack.run_once\"=>false, \"action_dispatch.request.path_parameters\"=>{:format=>\"1\", :controller=>\"docs\", :action=>\"index\"}, \"rack.request.cookie_string\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIGLyIPc2Vzc2lvbl9pZCI lNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg%3D--ceb0f44d2ac8df81c888e005abb7e9d1df02e802\", \"SCRIPT_NAME\"=>\"\", \"action_dispatch.parameter_filter\"=>[:密码, :数据], \"action_dispatch.show_exceptions\"=>false, \"HTTP_COOKIE\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIGLyIPc2Vzc2lvbl9pZCIlNmUwZT BiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg%3D--ceb0f44d2ac8df81c888e005abb7e9d1df02e802\", \"rack.multithread\"=>true, \"action_dispatch.request.request_parameters\"=>{}, \"rack.request.form_vars\"=>\"\", \"action_dispatch.cookies\"=>{\"_id_session\"=>\"BAh7ByIPb3JpZ2luX3VybCIYL2RvY3MuMT9mb3JtYXQ9aHRtbCI Pc2Vzc2lvbl9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg=--529dbf0f8e243c4830526f37adb777bd9fba49fd\"}, \"REQUEST_URI\"=>\"/docs.1\", \"rack.multiprocess\"=>true, \"rack.request.query_hash\"=>{\"format\"=>\"html\"}, \"rack.request.form_input\"=>#, \"SERVER_PORT\"=>\"80\", \"action_controller.instance\"=>#\"1\", \"action\"=>\"index\", \"controller\"=>\"docs\"}、@env={...}>、@cache_control={}、@body=[\" \"],@status=406,@length=0,@charset=\"utf-8\", @header={\"X-UA-兼容\"=>\"IE=Edge,chrome=1\", \"X-Runtime\"=>\"0.013935\", \"Content-Type\"=>\"text/html; 字符集=utf-8\", \"设置 Cookie\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIYL2RvY3MuMT9mb3JtYXQ9aHRtbCIPc2Vzc2lvbl 9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWVinty2Njg%3D--529dbf0f8e243c4830526f37adb777bd9fba49fd; 路径=/; HttpOnly\", \"Cache-Control\"=>\"no-cache\"}, @block=nil, @作者=#, @blank=true,@sending_file=false,@etag=nil, @内容类型=#, @cookie=[]>、@_headers={\"Content-Type\"=>\"text/html\"}、@docs=[#、#、#、#、#、#]、@_config =#, @国家=[#,#,#], @Continents=[#, #], @_action_name=\"索引\", @_request=#\"1\", \"action\"=>\"index\", \"controller\"=>\"docs\"}, @env={...}>, @lookup_context=#=>{\"layouts\"=>{\"nav\"=>{true=>[app/views/layouts/_nav.html.haml]}, \"application\"=>{false=>[app/views/layouts/application.html.haml]}, \"docs\"=>{false=>[]}}, \"docs\"=>{\"index\"=>{false=>[app/views/docs/index.html.haml]}}}}, @path=\"/home/jon/id/app/views\">,

@cached={#=>{\"layouts\"=>{\"docs\"=>{false=>[]}}}}, @path=\"/home/jon/.rvm/gems/ruby-1.8.7-p334/gems/devise-1.4.2/app/views\">], @details_key=nil,@skip_default_locale=false, @details={:formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :原子,:yaml,:multipart_form,:url_encoded_form,:json], :handlers=>[:haml, :builder, :erb, :rjs, :rhtml, :rxml], :locale=>[:en, :en]}, @frozen_formats=false>, @doc_types=[#, #], @_status=200, @view_context_class=nil, @action_has_layout=true>, \"rack.session.options\"=>{:secure=>false, :expire_after=>nil, :domain=>nil, :httponly=>true, :id=>\"6e0e0be703a2c2accf15121b1eb56668\", :path=>\"/\"}, \"REQUEST_METHOD\"=>\"GET\", \"warden\"=>Warden::Proxy:-616946978 @config={:default_scope=>:user, :failure_app=>Devise::FailureApp, :intercept_401=>false, :default_strategies=>{:user=>[:可记住, :database_authenticatable]}, :scope_defaults=>{}}, \"rack.request.query_string\"=>\"format=html\", \"rack.request.form_hash\"=>{}, \"action_dispatch.request.content_type\"=>#, \"QUERY_STRING\"=>\"format=html\", \"rack.input\"=>#}>"

这是response.inspect 输出:

“#true},@body=[\”\“],@status=406, @length=0, @charset=\"utf-8\", @header={\"X-UA-兼容\"=>\"IE=Edge,chrome=1\", \"Content-Type\"=>\"text/html; charset=utf-8\", \"X-运行时\"=>\"0.013935\", \"设置 Cookie\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIYL2RvY3MuMT9mb3JtYXQ9aHRtbCIPc2Vzc2lvbl 9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWVinty2Njg%3D--529dbf0f8e243c4830526f37adb777bd9fba49fd; 路径=/; HttpOnly\", \"Cache-Control\"=>\"no-cache\"}, @block=nil, @作者=#, @blank = false,@sending_file = false,@etag = nil, @内容类型=#, @cookie=[]>"

'goes_to_home' 测试按预期工作。在我的电脑上的开发环境中使用该页面也可以正常工作。这是服务器控制台输出:

于 2011 年 8 月 31 日星期三 05:19:20 +0200 开始对 127.0.0.1 获取“/docs/1” 由 DocsController#show as HTML 处理参数:{"id"=>"1"}
文档加载(1.0ms) SELECT docs.* FROM docs WHERE docs.id = 1 限制 1 个用户负载 (1.4ms) SELECT users.* FROM users WHERE users.id = 2 LIMIT 1 SQL (1.0ms) SELECT COUNT(*) FROM images WHERE (images.user_id = 2) CACHE (0.0ms) SELECT COUNT(*) FROM images WHERE (images.user_id = 2) 图像加载 (1.9ms) SELECT images.* FROM images WHERE (images.user_id = 2) ORDER BY Updated_at DESC LIMIT 1 打印负载(0.9ms) 选择打印。* FROM prints 位置 prints.image_id = 1 AND prints.doc_id = 1 LIMIT 1 渲染的布局/_nav.html.haml (8.5ms) 渲染的文档/show.html.haml 在布局/应用程序内 (172.7ms) 在 410ms 内完成 200 OK(视图: 225.0 毫秒 | ActiveRecord:6.2ms)

于 8 月 31 日星期三开始获取 127.0.0.1 的“/javascripts/dynamic_docs.js” 05:19:21 +0200 2011 由 JavascriptsController#dynamic_docs 处理 as JS 文档加载 (16.1ms) SELECT docs.* FROM docs Country Load (0.7 毫秒)从 国家 中选择 国家.*,其中 国家.id = 1 LIMIT 1 CACHE (1.2ms) 选择国家.* FROM 国家 WHERE 国家/地区.id = 1 LIMIT 1 国家/地区负载 (0.6ms) 选择 国家.* 来自国家,其中国家.id = 2 LIMIT 1
国家/地区负载 (0.6ms) SELECT countries.* FROM countries WHERE 国家/地区.id = 8 LIMIT 1 国家/地区负载 (0.6ms) 选择 国家.* 来自国家,其中国家.id = 18 LIMIT 1 渲染的 javascripts/dynamic_docs.js.erb (216.0ms) 完成 200 OK 270 毫秒(观看次数:238.2 毫秒 | ActiveRecord:19.8 毫秒)

于 8 月 31 日星期三开始获取 127.0.0.1 的“/image_for/US-Passport/1.jpg” 05:19:21 +0200 2011“美国护照” 30.0“head_top 39”“X:2.65000000000001,Y:28.85,宽度:222.7, 高度:222.7" 由 DocsController#image_for 作为 HTML 处理
参数:{"image_id"=>"1", "name"=>"US-Passport"} 用户负载 (2.0ms) SELECT users.* FROM users WHERE users.id = 2 LIMIT 1 图像加载 (0.9ms) SELECT images.* FROM images WHERE images.id = 1 AND (images.user_id = 2) ORDER BY Updated_at DESC LIMIT 1 Doc Load (1.0ms) SELECT docs.* FROM docs WHERE docs.name = '美国护照' LIMIT 1 渲染文本模板(0.1ms) 发送数据 Orange.jpg (13.2ms) 在 371ms 内完成 200 OK(浏览次数:12.9ms) | ActiveRecord:3.9ms)

有什么想法吗? 提前致谢

I have an integration test the sends a simple GET request to the 'show' action. I get a when I assert_response :success, it fails because the response is a 406, which means the format is Not Acceptable HTTP.

require 'test_helper'

class UserFlowsTest < ActionDispatch::IntegrationTest
  fixtures :continents, :countries, :types

  test "browse register order" do
    docs = make_docs
    assert_equal Doc.count, docs.length, "Docs not created properly"
    bob=new_session_as(:bob)
    bob.goes_to_home
    bob.goes_to_doc(1)
  end

  private

  module TestDSL
    def goes_to_home
      get root_url
      test_results("docs/index")
    end

    def goes_to_doc(id)
      get docs_url(id), #{:format => :html} - fails with this as well...
      y request.inspect
      p response.inspect
      test_results("docs/show")
    end

    def test_results(path)
      assert_response :success, "Checking #{path}"
      assert_template path
    end
  end #module TestDSL



  def new_session_as(person)
    new_session do |sess|
      #sess.goes_to_login
      #sess.logs_in_as(person)
      yield sess if block_given?
    end
  end

  def new_session
    open_session do |sess|
      sess.extend(TestDSL)
      yield sess if block_given?
    end
  end

end

Here is the request.inspect output:

--- "#[],
\"action_dispatch.request.parameters\"=>{\"format\"=>\"1\",
\"action\"=>\"index\", \"controller\"=>\"docs\"},
\"rack.session\"=>{\"origin_url\"=>\"/docs.1?format=html\",
\"session_id\"=>\"6e0e0be703a2c2accf15121b1eb56668\"},
\"rack.test\"=>true,
\"HTTP_ACCEPT\"=>\"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5\",
\"HTTP_HOST\"=>\"www.example.com\",
\"SERVER_NAME\"=>\"www.example.com\",
\"rack.request.cookie_hash\"=>{\"_id_session\"=>\"BAh7ByIPb3JpZ2luX3VybCIGLyIPc2Vzc2lvbl9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg=--ceb0f44d2ac8df81c888e005abb7e9d1df02e802\"},
\"action_dispatch.remote_ip\"=>#, \"CONTENT_LENGTH\"=>\"0\",
\"rack.url_scheme\"=>\"http\",
\"action_dispatch.request.query_parameters\"=>{\"format\"=>\"html\"},
\"action_dispatch.request.unsigned_session_cookie\"=>{\"origin_url\"=>\"/\",
\"session_id\"=>\"6e0e0be703a2c2accf15121b1eb56668\"},
\"CONTENT_TYPE\"=>\"application/x-www-form-urlencoded\",
\"HTTPS\"=>\"off\", \"rack.errors\"=>#,
\"action_dispatch.secret_token\"=>\"8922d5d0a3e706818581l8cc2d42d9ce584ba6350de71e6afc49b2ad7d3d05c6e763db2615fca9eb123c51b57223d955a5199b60c20e5efb4be14888a4e3520a2\",
\"REMOTE_ADDR\"=>\"127.0.0.1\", \"PATH_INFO\"=>\"/docs.1\",
\"rack.version\"=>[1, 1], \"rack.run_once\"=>false,
\"action_dispatch.request.path_parameters\"=>{:format=>\"1\",
:controller=>\"docs\", :action=>\"index\"},
\"rack.request.cookie_string\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIGLyIPc2Vzc2lvbl9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg%3D--ceb0f44d2ac8df81c888e005abb7e9d1df02e802\",
\"SCRIPT_NAME\"=>\"\",
\"action_dispatch.parameter_filter\"=>[:password, :data],
\"action_dispatch.show_exceptions\"=>false,
\"HTTP_COOKIE\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIGLyIPc2Vzc2lvbl9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg%3D--ceb0f44d2ac8df81c888e005abb7e9d1df02e802\",
\"rack.multithread\"=>true,
\"action_dispatch.request.request_parameters\"=>{},
\"rack.request.form_vars\"=>\"\",
\"action_dispatch.cookies\"=>{\"_id_session\"=>\"BAh7ByIPb3JpZ2luX3VybCIYL2RvY3MuMT9mb3JtYXQ9aHRtbCIPc2Vzc2lvbl9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg=--529dbf0f8e243c4830526f37adb777bd9fba49fd\"},
\"REQUEST_URI\"=>\"/docs.1\", \"rack.multiprocess\"=>true,
\"rack.request.query_hash\"=>{\"format\"=>\"html\"},
\"rack.request.form_input\"=>#,
\"SERVER_PORT\"=>\"80\",
\"action_controller.instance\"=>#\"1\", \"action\"=>\"index\",
\"controller\"=>\"docs\"}, @env={...}>, @cache_control={}, @body=[\"
\"], @status=406, @length=0, @charset=\"utf-8\",
@header={\"X-UA-Compatible\"=>\"IE=Edge,chrome=1\",
\"X-Runtime\"=>\"0.013935\", \"Content-Type\"=>\"text/html;
charset=utf-8\",
\"Set-Cookie\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIYL2RvY3MuMT9mb3JtYXQ9aHRtbCIPc2Vzc2lvbl9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg%3D--529dbf0f8e243c4830526f37adb777bd9fba49fd;
path=/; HttpOnly\", \"Cache-Control\"=>\"no-cache\"}, @block=nil,
@writer=#,
@blank=true, @sending_file=false, @etag=nil,
@content_type=#,
@cookie=[]>, @_headers={\"Content-Type\"=>\"text/html\"}, @docs=[#, #, #, #, #, #], @_config=#,
@countries=[#, #, #],
@continents=[#, #], @_action_name=\"index\",
@_request=#\"1\",
\"action\"=>\"index\", \"controller\"=>\"docs\"}, @env={...}>,
@lookup_context=#=>{\"layouts\"=>{\"nav\"=>{true=>[app/views/layouts/_nav.html.haml]},
\"application\"=>{false=>[app/views/layouts/application.html.haml]},
\"docs\"=>{false=>[]}},
\"docs\"=>{\"index\"=>{false=>[app/views/docs/index.html.haml]}}}},
@path=\"/home/jon/id/app/views\">,

@cached={#=>{\"layouts\"=>{\"docs\"=>{false=>[]}}}},
@path=\"/home/jon/.rvm/gems/ruby-1.8.7-p334/gems/devise-1.4.2/app/views\">],
@details_key=nil, @skip_default_locale=false,
@details={:formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss,
:atom, :yaml, :multipart_form, :url_encoded_form, :json],
:handlers=>[:haml, :builder, :erb, :rjs, :rhtml, :rxml],
:locale=>[:en, :en]}, @frozen_formats=false>, @doc_types=[#, #], @_status=200,
@view_context_class=nil, @action_has_layout=true>,
\"rack.session.options\"=>{:secure=>false, :expire_after=>nil,
:domain=>nil, :httponly=>true,
:id=>\"6e0e0be703a2c2accf15121b1eb56668\", :path=>\"/\"},
\"REQUEST_METHOD\"=>\"GET\", \"warden\"=>Warden::Proxy:-616946978
@config={:default_scope=>:user, :failure_app=>Devise::FailureApp,
:intercept_401=>false, :default_strategies=>{:user=>[:rememberable,
:database_authenticatable]}, :scope_defaults=>{}},
\"rack.request.query_string\"=>\"format=html\",
\"rack.request.form_hash\"=>{},
\"action_dispatch.request.content_type\"=>#,
\"QUERY_STRING\"=>\"format=html\",
\"rack.input\"=>#}>"

and here is the response.inspect output:

"#true}, @body=[\" \"], @status=406,
@length=0, @charset=\"utf-8\",
@header={\"X-UA-Compatible\"=>\"IE=Edge,chrome=1\",
\"Content-Type\"=>\"text/html; charset=utf-8\",
\"X-Runtime\"=>\"0.013935\",
\"Set-Cookie\"=>\"_id_session=BAh7ByIPb3JpZ2luX3VybCIYL2RvY3MuMT9mb3JtYXQ9aHRtbCIPc2Vzc2lvbl9pZCIlNmUwZTBiZTcwM2EyYzJhY2NmMTUxMjFiMWViNTY2Njg%3D--529dbf0f8e243c4830526f37adb777bd9fba49fd;
path=/; HttpOnly\", \"Cache-Control\"=>\"no-cache\"}, @block=nil,
@writer=#,
@blank=false, @sending_file=false, @etag=nil,
@content_type=#,
@cookie=[]>"

the 'goes_to_home' test works as expected. Using the page in the development environment on my pc also works fine. Here is the server console output:

Started GET "/docs/1" for 127.0.0.1 at Wed Aug 31 05:19:20 +0200 2011
Processing by DocsController#show as HTML Parameters: {"id"=>"1"}
Doc Load (1.0ms) SELECT docs.* FROM docs WHERE docs.id = 1
LIMIT 1 User Load (1.4ms) SELECT users.* FROM users WHERE
users.id = 2 LIMIT 1 SQL (1.0ms) SELECT COUNT(*) FROM images
WHERE (images.user_id = 2) CACHE (0.0ms) SELECT COUNT(*) FROM
images WHERE (images.user_id = 2) Image Load (1.9ms) SELECT
images.* FROM images WHERE (images.user_id = 2) ORDER BY
updated_at DESC LIMIT 1 Print Load (0.9ms) SELECT prints.* FROM
prints WHERE prints.image_id = 1 AND prints.doc_id = 1 LIMIT
1 Rendered layouts/_nav.html.haml (8.5ms) Rendered docs/show.html.haml
within layouts/application (172.7ms) Completed 200 OK in 410ms (Views:
225.0ms | ActiveRecord: 6.2ms)

Started GET "/javascripts/dynamic_docs.js" for 127.0.0.1 at Wed Aug 31
05:19:21 +0200 2011 Processing by JavascriptsController#dynamic_docs
as JS Doc Load (16.1ms) SELECT docs.* FROM docs Country Load
(0.7ms) SELECT countries.* FROM countries WHERE countries.id
= 1 LIMIT 1 CACHE (1.2ms) SELECT countries.* FROM countries
WHERE countries.id = 1 LIMIT 1 Country Load (0.6ms) SELECT
countries.* FROM countries WHERE countries.id = 2 LIMIT 1
Country Load (0.6ms) SELECT countries.* FROM countries WHERE
countries.id = 8 LIMIT 1 Country Load (0.6ms) SELECT
countries.* FROM countries WHERE countries.id = 18 LIMIT 1
Rendered javascripts/dynamic_docs.js.erb (216.0ms) Completed 200 OK in
270ms (Views: 238.2ms | ActiveRecord: 19.8ms)

Started GET "/image_for/US-Passport/1.jpg" for 127.0.0.1 at Wed Aug 31
05:19:21 +0200 2011 "US Passport"
30.0 "head_top 39" "X: 2.65000000000001, Y: 28.85, width: 222.7,
height: 222.7" Processing by DocsController#image_for as HTML
Parameters: {"image_id"=>"1", "name"=>"US-Passport"} User Load
(2.0ms) SELECT users.* FROM users WHERE users.id = 2 LIMIT 1
Image Load (0.9ms) SELECT images.* FROM images WHERE
images.id = 1 AND (images.user_id = 2) ORDER BY updated_at DESC
LIMIT 1 Doc Load (1.0ms) SELECT docs.* FROM docs WHERE
docs.name = 'US Passport' LIMIT 1 Rendered text template (0.1ms)
Sent data orange.jpg (13.2ms) Completed 200 OK in 371ms (Views: 12.9ms
| ActiveRecord: 3.9ms)

Any ideas?
Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小鸟爱天空丶 2024-12-09 17:32:00

此问题是由于在“get”调用中使用错误的路径引起的。

由于某种原因 docs_url(@doc) 生成“/docs.7”而不是“/docs/7”

我打开了 关于此主题的单独问题

This problem is being caused by using the wrong path in the 'get' call.

for some reason docs_url(@doc) produces "/docs.7" instead of "/docs/7"

I have opened a separate question on this topic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文