Wolfram Arnold
2009-Jun-22 06:53 UTC
[rspec-users] [Cucumber] Successive requests with xml Content-Type fail?
I''m writing a cucumber test for an xml webservice. When making POST''s the Content-Type in the header is set to "application/xml" and for any request, the Accept header is set to "application/xml" (aka Mime::XML.to_s) I''m running into the following issue: When I make two successive requests, the first one being a POST to log the user in; the second one a GET to retrieve some data, the second request always seems to fail with this error: private method `split'' called for #<Mime::Type:0x7f60a708ff70> (NoMethodError) /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/mime_type.rb:206:in `method_missing'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:51:in `media_type'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:117:in `parseable_data?'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:138:in `POST'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/request.rb:428:in `request_parameters'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/request.rb:381:in `parameters'' This started happening only in Rails 2.3. It previously worked fine with Rails 2.0 Now, I dug into this some more; the Session class in webrat core seems to get instantiated once for the entire scenario and the instance sticks around for all of the requests. I noticed by checking with the debugger, that the header object gets transformed into a Rack header object and acquires things like the referrer field from the first request. On the second request (the GET), the Content-Type is set but it probably shouldn''t--as there is no payload data, it''s a GET--and that causes havoc. I''m kind of lost as to whether this is a bug in Rack or Rails or Webrat or whether I''m doing something wrong. Any advice is appreciated. -- Posted via http://www.ruby-forum.com/.
David Chelimsky
2009-Jun-22 08:22 UTC
[rspec-users] [Cucumber] Successive requests with xml Content-Type fail?
On Mon, Jun 22, 2009 at 1:53 AM, Wolfram Arnold<lists at ruby-forum.com> wrote:> I''m writing a cucumber test for an xml webservice. ?When making POST''s > the Content-Type in the header is set to "application/xml" and for any > request, the Accept header is set to "application/xml" (aka > Mime::XML.to_s) > > I''m running into the following issue: > > When I make two successive requests, the first one being a POST to log > the user in; the second one a GET to retrieve some data, the second > request always seems to fail with this error: > > ? ? ?private method `split'' called for #<Mime::Type:0x7f60a708ff70> > (NoMethodError) > ? ? ?/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/mime_type.rb:206:in > `method_missing'' > ? ? ?/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:51:in > `media_type'' > ? ? ?/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:117:in > `parseable_data?'' > ? ? ?/usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:138:in > `POST'' > ? ? ?/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/request.rb:428:in > `request_parameters'' > ? ? ?/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/request.rb:381:in > `parameters'' > > > This started happening only in Rails 2.3. ?It previously worked fine > with Rails 2.0 > > Now, I dug into this some more; the Session class in webrat core seems > to get instantiated once for the entire scenario and the instance sticks > around for all of the requests. ?I noticed by checking with the > debugger, that the header object gets transformed into a Rack header > object and acquires things like the referrer field from the first > request. ?On the second request (the GET), the Content-Type is set but > it probably shouldn''t--as there is no payload data, it''s a GET--and that > causes havoc. ?I''m kind of lost as to whether this is a bug in Rack or > Rails or Webrat or whether I''m doing something wrong. > > Any advice is appreciated.Cucumber has had a separate list for some time now. Please post this to http://groups.google.com/group/cukes. Cheers, David