I have encountered a problem with a RESTful route, I have the simple route; r.resources :people With a corresponding controller, when I tried to access it using ActiveResource I get a server error, I have tracked this down to a problem where if the header ''Content-Type: application/xml'' is sent it errors out:> curl -H ''Accept: */*'' http://localhost:4000/people/test.xml<?xml version="1.0" encoding="utf-8"?> <person><name>John</name></person>> curl -H ''Content-Type: application/xml'' -H ''Accept: */*'' http://localhost:4000/people/test.xmlcurl: (18) transfer closed with 475 bytes remaining to read 500 Internal Server Error I can''t seem to replicate this with a spec so I''m not sure what''s going on here. I''m running trunk merb updated as of this morning. I tried several days ago as well and had the same results. The following trace is in the logs: Request: REQUEST_URI: /people/test.xml (2007-09-21 11:13:31) undefined method `to_hash'' for nil:NilClass - (NoMethodError) /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/core_ext/hash.rb:265:in `from_xml'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/core_ext/hash.rb:67:in `from_xml'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/request.rb:83:in `xml_params'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/request.rb:96:in `params'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/controller.rb:49:in `set_dispatch_variables'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/controller.rb:43:in `build'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:84:in `dispatch_default_exception'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:74:in `dispatch_exception'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/dispatcher.rb:37:in `handle'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/mongrel_handler.rb:89:in `process'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in `process_client'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `each'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `process_client'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `initialize'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `new'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `initialize'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `new'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `run'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:271:in `run'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in `each'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:270:in `run'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:523:in `cloaker_'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:51:in `call'' /usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/configurator.rb:51:in `initialize'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:513:in `new'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:513:in `mongrel_start'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/server.rb:442:in `run'' /usr/lib/ruby/gems/1.8/gems/merb-0.4.0/bin/merb:6 /usr/bin/merb:16:in `load'' /usr/bin/merb:16
Michael D. Ivey
2007-Sep-21 15:59 UTC
RESTful route gives a 500 error when Content-Type is set
On Sep 21, 2007, at 10:15 AM, Paul Dlug wrote:> I have encountered a problem with a RESTful route, I have the > simple route;I put this in Trac: http://merb.devjavu.com/ticket/203 I''ll try to look at it this afternoon, if no one else does. (BTW, Ez, I''m seeing 500s on Trac intermittently. Every 2 or 3 requests.)