我发现我的AJAX DELETE请求不发送数据参数到控制器,当我通过水豚,WebKit的执行。然而,数据参数也被发送(和测试通过),当我运行测试套件通过使用硒。我的code如下所示:
I'm finding that my ajax DELETE requests are not sending data parameters to the controller when I execute them through capybara-webkit. However, the data parameters do get sent (and the test passes) when I run the test suite by using selenium. My code looks like the following:
$(document).on 'click', 'a.delete_contact', ->
if confirm "Are you sure you want to delete this contact?"
id = $('a.delete_contact').data('id')
name = $('a.delete_contact').data('name')
$.ajax '/contacts',
type: 'DELETE'
dataType: 'html'
data: {'id' : id}
success: ->
$("li[data-cid='#{id}']").remove()
removeInitial(_.last(name.split(" "))[0])
show_notice("Contact successfully destroyed.", 'notice')
window.contactSelection.pop()
refreshSelectionView()
return false
任何想法,为什么这种失败在水豚,WebKit的?
Any ideas why this is failing in capybara-webkit?
显然QtWebKit的不支持的实体机构,DELETE请求。
Apparently QtWebKit does not support an entity body with DELETE requests.
的https://github.com/thoughtbot/capybara-webkit/issues/427#issuecomment-12200262
一个水豚,WebKit的开发者推荐使用这种解决方法:...... [发送]有一个参数标识请求为删除此机制是Rails的工作,跨浏览器的周围类似的问题POST请求
A capybara-webkit developer recommended this work-around: "[Send] a POST request with a parameter identifying the request as a DELETE. This mechanism is used by Rails to work around similar issues across browsers."
上一篇:Live搜索的使用codeigniter的MysqlLive、codeigniter、Mysql
下一篇:Javascript的响应从加载网页没有显示与<跨度>虽然我可以看到它在Firebug可以看到、跨度、它在、加载