简体   繁体   English

Rails上的HTTP请求格式错误?

[英]Malformed HTTP requests on rails?

I'm getting this occacional error from my rails app: 我从Rails应用程序中收到此职业错误:

ActionController::MethodNotAllowed: Only get, put, and delete requests are allowed. ActionController :: MethodNotAllowed:仅允许获取,放置和删除请求。

I think it's caused by a malformed HTTP request (in this case a DELETE request) caused by the client browser... Maybe? 我认为这是由客户端浏览器导致的HTTP请求格式错误(在这种情况下为DELETE请求)引起的。

The URL that triggers this action it's like: 触发此操作的URL类似于:

https://domain.com/resource/id/resource/id/resource/id.js?item_id=xxx https://domain.com/resource/id/resource/id/resource/id.js?item_id=xxx

Which is generated by a helper like: 它是由诸如以下的助手生成的:

link_to_remote('delete', :url => resource_path(:id => @resource, :item_id => xxx, :format => :js), :method => :delete)

In some remote cases this crashes, I suspect that this happens only in IE (even IE8)... 在某些远程情况下,这会崩溃,我怀疑这仅发生在IE(甚至IE8)中...

If it is the case, what would be a solution? 如果是这样,将有什么解决方案? it supossed this should work in all browsers... 它认为这应该适用于所有浏览器...

What do you suggest, guys? 你们有什么建议吗?

Thanks for your help. 谢谢你的帮助。

您可以使用定义_method参数来模拟DELETE请求以“删除”并发布您的请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM