"can't convert nil into Hash" when submitting a multipart form #13
Comments
Are other people seeing this too when posting multipart forms? I'm curious if it's something specific to my setup which I could debug. |
I got this area too today. Seems if the form does not have an attachment, it will bomb. |
Got this as well... |
Had a look at this one myself, we get an error, slightly different though:
Looked through the webkit_server cpp code, and couldn't see where it might be a problem, thought maybe it was linkDelegationPolicy handling but no luck there. |
Got the same error. Turns out that rack is raising: EOFError: bad content body right here: https://github.com/rack/rack/blob/master/lib/rack/request.rb#L182 unless @env["rack.request.form_hash"] = parse_multipart(env) on the next request after submitting multipart form. |
I'm having the same issue with same error as fxposter (bad content body). Any workarounds for this? |
I have done this in my forms view code (HAML). A bit hacky, but it works.
|
Unfortunately that will not test the use of the form to submit attachments. |
@metaskills this is definitely not an option. |
Same problem here. Any hints to workarounds appreciated. |
Any progress here? This is really the only thing holding us back on using this great gem. I'd love to help out myself, but I have no idea how to go about debugging this. |
Same here. The form gets submitted, but the redirect (the next GET request) fails with "Unable to load URL", if I turn off multipart forms, it works. |
Getting the same issue as @excepttheweasel. Looking for a work-around... anyone have progress here?
|
This worked for me: # config/environments/test.rb
class CapybaraWebkitFixer
def initialize(app)
@app = app
end
def call(env)
if env['REQUEST_METHOD'] == "GET" && env['CONTENT_TYPE'] && env['CONTENT_TYPE'] =~ /^multipart/
env['CONTENT_TYPE'] = nil
end
@app.call(env)
end
end
Rails.application.config.middleware.insert_after Rack::Runtime, CapybaraWebkitFixer |
+1 I'm getting the same error when submitting a multi-part form w/o any file attachments.
|
@ebeigarts: that hack fixes the behavior for me too. I have this problem with a Rails 3.1.0 app on ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin11.1.0]. A few debugging hints for capybara-webkit.. Show server debug output: Enable a lot of client debug output: This shows the wire-protocol for the webkit driver, which may come in handy. |
This has been fixed in #162 |
Works like a charm, thank you @ebeigarts! :) |
When will this be available for a general "gem install"? |
A new version of the gem with this fix would indeed be great. |
A gem was released with this fix a while ago. |
When I try to post any multipart form in the app, webrick crashes:
I'm having trouble finding any more info in any of the logs.
The text was updated successfully, but these errors were encountered: