Module: Skink::Client::Utils
Instance Method Summary collapse
Instance Method Details
#normalize_header_name(name) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/skink/client/utils.rb', line 5 def normalize_header_name(name) # c.f http://en.wikipedia.org/wiki/List_of_HTTP_header_fields case name # special cases when /^content_md5$/i return "Content-MD5" when /^te$/i return "TE" when /^dnt$/i return "DNT" when /^etag$/i return "ETag" when /^www_authenticate$/i return "WWW-Authenticate" end # otherwise this should work name.to_s.split(/[_-]/).map(&:capitalize).join("-") end |