Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/middle_squid/core_ext/hash.rb
Constant Summary collapse
- IGNORED_HEADERS =
[ 'Connection', 'Content-Encoding', 'Content-Length', 'Host', 'Transfer-Encoding', 'Version', ].freeze
- DASH =
'-'.freeze
- UNDERSCORE =
'_'.freeze
Instance Method Summary collapse
Instance Method Details
#sanitize_headers! ⇒ Hash
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/middle_squid/core_ext/hash.rb', line 15 def sanitize_headers! clean = {} each {|key, value| key = key.tr UNDERSCORE, DASH key = key.split(DASH).map(&:capitalize).join(DASH) next if IGNORED_HEADERS.include? key clean[key] = value } clear merge! clean end |