{"issue":{"created_at":"2011-12-14T16:00:38Z","state":"open","updated_at":"2011-12-14T16:00:39Z","user":{"gravatar_id":"3d0c3324e327edea63f4a10f4f4b3a13","id":223481,"url":"https://api.github.com/users/jgonera","login":"jgonera","avatar_url":"https://secure.gravatar.com/avatar/3d0c3324e327edea63f4a10f4f4b3a13?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":0,"body":"This is a really weird one and started when I upgraded to 0.7.x. When your application makes an AJAX request with those headers:\r\n\r\n```js\r\nreq.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\r\nreq.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\r\n```\r\n\r\nfor some reason when you run Capybara tests with capybara-webkit the AJAX request always fails with error 500. If I remove those headers, everything works fine. I prepared a minimal test case in a fresh Rails 3.1.3 app: https://github.com/jgonera/capybara-webkit-bug\r\n\r\nThe app has just one action which returns a page that contains a script that makes an AJAX request to the root path, i.e. it requests the HTML of the page itself and prints it in the console. You can open it in the browser with JS console to see how it works.\r\n\r\nNow run `rspec spec`. The spec will fail. Now, try removing the headers in `app/views/test/index.html.erb`, it will succeed. Also, if you change to selenium it will work as expected. After running a test, see `log/test.log`, the error 500 will appear there but with no stack trace whatsoever.","assignee":null,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"id":2553408,"labels":[],"number":228,"title":"Regression: capybara-webkit causes apps to return error 500 on some AJAX requests","html_url":"https://github.com/thoughtbot/capybara-webkit/issues/228","closed_at":null,"url":"https://api.github.com/repos/thoughtbot/capybara-webkit/issues/228","milestone":null},"action":"opened"}