Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle symbol header #83

Closed
brissmyr opened this issue Nov 20, 2017 · 0 comments · Fixed by #84
Closed

Handle symbol header #83

brissmyr opened this issue Nov 20, 2017 · 0 comments · Fixed by #84
Assignees
Labels

Comments

@brissmyr
Copy link
Member

Clearance sends a symbol header (:clearance) instead of string, which crashes the parsing.

[2] pry(#<Castle::HeaderFormatter>)>

From: /Users/brissmyr/.rvm/gems/ruby-2.2.4/gems/castle-rb-3.0.0/lib/castle/header_formatter.rb @ line 7 Castle::HeaderFormatter#call:

    5: def call(header)
    6:   binding.pry
 => 7:   header.gsub(/^HTTP(?:_|-)/i, '').split(/_|-/).map(&:capitalize).join('-')
    8: end

[1] pry(#<Castle::HeaderFormatter>)> header
=> "action_dispatch.request.content_type"
[2] pry(#<Castle::HeaderFormatter>)>

From: /Users/brissmyr/.rvm/gems/ruby-2.2.4/gems/castle-rb-3.0.0/lib/castle/header_formatter.rb @ line 7 Castle::HeaderFormatter#call:

    5: def call(header)
    6:   binding.pry
 => 7:   header.gsub(/^HTTP(?:_|-)/i, '').split(/_|-/).map(&:capitalize).join('-')
    8: end

[1] pry(#<Castle::HeaderFormatter>)> header
=> :clearance
[2] pry(#<Castle::HeaderFormatter>)>
Completed 500 Internal Server Error in 179877ms

NoMethodError (undefined method `gsub' for :clearance:Symbol):
  app/controllers/sessions_controller.rb:11:in `create'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants