Method: Gem::Net::HTTPHeader#type_params
- Defined in:
- lib/rubygems/net-http/lib/net/http/header.rb
#type_params ⇒ Object
Returns the trailing (‘parameters’) part of the value of field 'Content-Type', or nil if no such field exists; see Content-Type response header:
res = Gem::Net::HTTP.get_response(hostname, '/todos/1')
res['content-type'] # => "application/json; charset=utf-8"
res.type_params # => {"charset"=>"utf-8"}
753 754 755 756 757 758 759 760 761 762 |
# File 'lib/rubygems/net-http/lib/net/http/header.rb', line 753 def type_params result = {} list = self['Content-Type'].to_s.split(';') list.shift list.each do |param| k, v = *param.split('=', 2) result[k.strip] = v.strip end result end |