Module: HTTP::Header
Constant Summary collapse
- CANONICAL_HEADER =
Matches HTTP header names when in “Canonical-Http-Format”
/^[A-Z][a-z]*(-[A-Z][a-z]*)*$/
Instance Method Summary collapse
-
#canonicalize_header(header) ⇒ Object
Transform to canonical HTTP header capitalization.
Instance Method Details
#canonicalize_header(header) ⇒ Object
Transform to canonical HTTP header capitalization
7 8 9 |
# File 'lib/http/header.rb', line 7 def canonicalize_header(header) header.to_s.split(/[\-_]/).map(&:capitalize).join('-') end |