WebkitInvalidResponseError on some POST #162

Closed
benjiec opened this Issue Sep 15, 2011 · 17 comments

Projects

None yet
@benjiec

In some cases, when I issue a visit, then a click that triggers a post request, I see on the log that the POST occurs, but after the POST, anything I do with capybara I get a Capybara::Driver::Webkit::WebkitInvalidResponseError, saying something like

   Unable to load URL: http://127.0.0.1:40583/runs/1

This does not happen on all POSTs. I also made a barebone controller as a "control" and that does not manifest this behavior, so I suspect it's somewhere in my controller for the POST that's causing this, but rack_test and normal browser all work fine on that POST.

Has anyone ran into something like this before?

I had thought the reason was because of the redirect after the POST, but even if I just do POST w/o redirect, subsequent visit via capybara-webkit still gives me this error.

@halogenandtoast

I believe this issue is related to the fact the QTWebkit resends the Content-Type header on redirects. So for instance, if you have a multipart form that submits to an action that redirects, the multipart Content-Type will be sent and Rack will choke on it. There is a fix in the works for this issue and it should be in master today or tomorrow.

@benjiec

Matthew,

Awesome. Thanks for getting back so fast. I didn't check enctype set to multipart. And I can now verify that is exactly what fails. Using a simple controller and view, post w/ multipart content-type fails, but post w/o enctype works.

Thanks.

@halogenandtoast halogenandtoast added a commit that closed this issue Sep 15, 2011
Matthew Mongeau and Joe Ferris Redirects should not send content type. Fixes #162 25fe9be
@rud rud added a commit to rud/capybara-webkit that referenced this issue Sep 16, 2011
Matthew Mongeau and Joe Ferris Redirects should not send content type. Fixes #162 cc2e948
@rud

@halogenandtoast it works like an absolute charm, thank you! :)

@jedeleh

Can we get a new version of the gem with this fix included? I've got a deploy process that is not setup to build a custom version of a gem and I'd like to avoid revamping my build/deploy process if possible.

@dgilperez

This issue has been bugging us for a while ... thanks for fixing it, you're awesome guys!

@vitobotta

Any update on this? I am getting the same error :(

@jedeleh
@vitobotta

Hi jedeleh, thanks a lot for your response. I have tried tons of things including building from the git repo etc, but the problem remains. Funny thing, I think I have managed to isolate what seems to be causing it... it's (if I am right) the jQuery autocomplete... but I am not 100% sure yet and haven't found any workarounds yet :(

@rud

I've left my fork up for now with the fix for this and another bug at https://github.com/rud/capybara-webkit, if that is any help.

@cj
cj commented Feb 6, 2012

I'm getting the same issue on get requests: (I tried your git repo too @rud)

  1) Main app Should login with correct info
     Failure/Error: visit "/calls"
     Capybara::Driver::Webkit::WebkitInvalidResponseError:
       Unable to load URL: http://127.0.0.1:53529/calls

If I use selenium it works just fine....

@rud
rud commented Feb 7, 2012

@cj Over at #13 (comment) I posted some tips on how to get more debug output from both client and server when running with capybara-webkit. First try the webkit_debug driver, it's super easy, and you'll get a better feel for what is happening on the server.

@flomotlik

Any update on this issue?

Just tried with the latest HEAD as well as the latest released version and both fail.

Also tried it with @rud HEAD, but didn't work either

Works fine with selenium.

@yashke

I had same exception at the end of one of my test suites - it seems like webkit tries to send request to webserver (thin), but it is shutted down. I removed thin, so tests run on webrick and exception is gone.

@rb2k

I ran into something similar too. For me it happens when clicking a link within an iframe (using within_frame)

@ghost

It happens for me as well. But it happens randomly.

@eduardohertz

Same problem here. Any solution?

@kurko

Still happening. Selenium works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment