module Ur::RequestAndResponse
Public Instance Methods
content_type()
click to toggle source
@return [Ur::ContentType] the string value of the content type header. returns an {Ur::ContentType}, a subclass of String which additionally parses the Content-Type according to relevant RFCs.
# File lib/ur/request_and_response.rb, line 31 def content_type headers.each do |k, v| return ContentType.new(v) if k =~ /\Acontent[-_]type\z/i end nil end
form_urlencoded?()
click to toggle source
@return [Boolean] is our content type x-www-form-urlencoded?
# File lib/ur/request_and_response.rb, line 54 def form_urlencoded? content_type && content_type.form_urlencoded? end
json?()
click to toggle source
@return [Boolean] is our content type JSON?
# File lib/ur/request_and_response.rb, line 44 def json? content_type && content_type.json? end
media_type()
click to toggle source
the media type of the content type
# File lib/ur/request_and_response.rb, line 39 def media_type content_type ? content_type.media_type : nil end
xml?()
click to toggle source
@return [Boolean] is our content type XML?
# File lib/ur/request_and_response.rb, line 49 def xml? content_type && content_type.xml? end