End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTPHeader#main_type
main_type
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/net/http/header.rb, line 365
def main_type
return nil unless @header['content-type']
self['Content-Type'].split(';').first.to_s.split('/')[0].to_s.strip
end
Returns a content type string such as “text”. This method returns nil if Content-Type: header field does not exist.
See also
#key?
#proxy_basic_auth
#initialize_http_header
#range
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0