Class: Mayu::Fetch::Response

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mayu/fetch.rb

Instance Method Summary collapse

Instance Method Details

#content_typeObject



35
36
37
# File 'lib/mayu/fetch.rb', line 35

def content_type
  headers.fetch("content-type").to_s
end

#inspectObject



40
41
42
# File 'lib/mayu/fetch.rb', line 40

def inspect
  "<##{self.class.name} url=#{url.inspect} status=#{status.inspect} status_text=#{status_text.inspect} content_type=#{content_type.inspect} body=#{body.bytesize}b>"
end

#json(symbolize_names: false) ⇒ Object



30
31
32
# File 'lib/mayu/fetch.rb', line 30

def json(symbolize_names: false)
  JSON.parse(body, symbolize_names:)
end