Giter Club home page Giter Club logo

Comments (21)

thijsc avatar thijsc commented on June 23, 2024

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.

from capybara-webkit.

metaskills avatar metaskills commented on June 23, 2024

I got this area too today. Seems if the form does not have an attachment, it will bomb.

from capybara-webkit.

jens avatar jens commented on June 23, 2024

Got this as well...

from capybara-webkit.

j16r avatar j16r commented on June 23, 2024

Had a look at this one myself, we get an error, slightly different though:

Internal Server Error

bad content body
WEBrick/1.3.1 (Ruby/1.8.7/2011-02-18) at 127.0.0.1:56925

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.

from capybara-webkit.

fxposter avatar fxposter commented on June 23, 2024

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.

from capybara-webkit.

reedlaw avatar reedlaw commented on June 23, 2024

I'm having the same issue with same error as fxposter (bad content body). Any workarounds for this?

from capybara-webkit.

metaskills avatar metaskills commented on June 23, 2024

I have done this in my forms view code (HAML). A bit hacky, but it works.

:html => { :multipart => !Rails.env.test? }

from capybara-webkit.

reedlaw avatar reedlaw commented on June 23, 2024

Unfortunately that will not test the use of the form to submit attachments.

from capybara-webkit.

fxposter avatar fxposter commented on June 23, 2024

@metaskills this is definitely not an option.

from capybara-webkit.

kilaulena avatar kilaulena commented on June 23, 2024

Same problem here. Any hints to workarounds appreciated.

from capybara-webkit.

thijsc avatar thijsc commented on June 23, 2024

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.

from capybara-webkit.

ebeigarts avatar ebeigarts commented on June 23, 2024

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.

from capybara-webkit.

melcher avatar melcher commented on June 23, 2024

Getting the same issue as @excepttheweasel. Looking for a work-around... anyone have progress here?

Internal Server Error

bad content body
WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18) at 127.0.0.1:56993

from capybara-webkit.

ebeigarts avatar ebeigarts commented on June 23, 2024

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

from capybara-webkit.

jfelchner avatar jfelchner commented on June 23, 2024

+1 I'm getting the same error when submitting a multi-part form w/o any file attachments.

Internal Server Error
can't convert nil into Hash
WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)

from capybara-webkit.

rud avatar rud commented on June 23, 2024

@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:
lib/capybara.rb in the gem: set Thin::Logging.silent = false in run_default_server to see this error.

Enable a lot of client debug output:
Use: Capybara.javascript_driver = :webkit_debug
instead of
Capybara.javascript_driver = :webkit

This shows the wire-protocol for the webkit driver, which may come in handy.

from capybara-webkit.

ebeigarts avatar ebeigarts commented on June 23, 2024

This has been fixed in #162

from capybara-webkit.

rud avatar rud commented on June 23, 2024

Works like a charm, thank you @ebeigarts! :)

from capybara-webkit.

jedeleh avatar jedeleh commented on June 23, 2024

When will this be available for a general "gem install"?

from capybara-webkit.

thijsc avatar thijsc commented on June 23, 2024

A new version of the gem with this fix would indeed be great.

from capybara-webkit.

jferris avatar jferris commented on June 23, 2024

A gem was released with this fix a while ago.

from capybara-webkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.