This project is archived and is in readonly mode.

#6546 open
Pablo Cantero

Error sending empty Content-Type instrumentation.rb#22

Reported by Pablo Cantero | March 9th, 2011 @ 02:50 AM

Hi

I'm using Titanium to create an iPhone app which is integrating with my Rails app

Titanium XHR client, by default it is sending empty Content-Type. I don't know if it is a problem (it is a suggestion!), but when I try to access Rails app passing empty Content-type, I get this error

ConditionsController# (NoMethodError) "undefined method `to_sym' for nil:NilClass"

/app/3b9e4331-7f19-4831-85c3-a3d12c69c2e9/home/.bundle/gems/ruby/1.8/gems/rack-mount-0.6.13/lib/rack/mount/code_generation.rb:63:in to_proc' /app/3b9e4331-7f19-4831-85c3-a3d12c69c2e9/home/.bundle/gems/ruby/1.8/gems/actionpack-3.0.3/lib/action_controller/metal/instrumentation.rb:22:inmap' ...

This error occurs at this point ":formats => request.formats.map(&:to_sym)"

    # instrumentation.rb
    def process_action(action, *args)
      raw_payload = {
        :controller => self.class.name,
        :action     => self.action_name,
        :params     => request.filtered_parameters,
        :formats    => request.formats.map(&:to_sym),
        :method     => request.method,
        :path       => (request.fullpath rescue "unknown")
      }

The current error message not is clear, my suggest is to add a clear/specific error message

rescue "The Content-Type was not supplied" if request.formats.map.empty?, or use "Content-Type: text/html" as default

I created this ticket, because the current stacktrace for this problem is hard to understand, I spent a few hours to solve it. I also created a forum thread on Titanium Q&A

Pablo Cantero

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages