This project is archived and is in readonly mode.
head method attempts to camelcase headers
-
Maxim Chernyak
+1 reproduced exactly the same way.
-
Maxim Chernyak
Only on Ruby 1.8.7.
-
Rohit Arondekar
- Milestone cleared.
- State changed from new to open
- Importance changed from to Low
-
Maxim Chernyak
Looks like we need to avoid
capitalizehere: http://github.com/rails/rails/blob/master/actionpack/lib/action_con...capitalizenot only upcases first letter, but also downcases the rest of them. Making a patch to avoidcapitalize. -
Rohit Arondekar
- Assigned user set to José Valim
-
Maxim Chernyak
- Tag changed from rails 3.0.0 to rails 3.0.0, patch
Here's patch + test against master.
-
Seth Ladd
Thanks! That should help a ton.
-
José Valim
Looks good, but couldn't we do something like this instead:
headers[key.to_s.dasherize.split("-").each { |v| v[0] = v[0].upcase }.join("-")] = value.to_s
Seems faster and simpler!
-
Maxim Chernyak
@Jose
Almost right.
v[0] = v[0].chr.upcase. Will fix now, sec. -
José Valim
One question. Why do we need .chr? It worked fine without it on 1.8.7 and 1.9.2.
-
Maxim Chernyak
Strange.
ruby-1.8.7-p302 > v = 'foo' => "foo" ruby-1.8.7-p302 > v[0] = v[0].upcase NoMethodError: undefined method `upcase' for 102:Fixnum from (irb):2 -
José Valim
Sorry, it was my bad. You are correct sir!
-
Maxim Chernyak
Happens. :) I don't know why I didn't do first char assignment in the first place, thanks.
Here's the new patch.
-
Repository
- State changed from open to resolved
(from [20685d07ab5853457e1d11467f22ed42568e20f4]) Fix header capitalization by explicitly upcasing first letter of every word, and avoiding capitalize. [#5636 head method attempts to camelcase headers state:resolved] http://github.com/rails/rails/commit/20685d07ab5853457e1d11467f22ed...
-
Ryan Bigg
- Tag changed from rails 3.0.0, sheepskin boots, patch to patch rails 3.0.0
Automatic cleanup of spam.
