class WebMock::RequestSignature
def assign_options(options)
def assign_options(options) self.body = options[:body] if options.has_key?(:body) self.headers = options[:headers] if options.has_key?(:headers) end
def eql?(other)
def eql?(other) self.to_s == other.to_s end
def hash
def hash self.to_s.hash end
def headers=(headers)
def headers=(headers) @headers = WebMock::Util::Headers.normalize_headers(headers) end
def initialize(method, uri, options = {})
def initialize(method, uri, options = {}) self.method = method.to_sym self.uri = uri.is_a?(Addressable::URI) ? uri : WebMock::Util::URI.normalize_uri(uri) assign_options(options) end
def json_headers?
def json_headers? !!(headers&.fetch('Content-Type', nil)&.start_with?('application/json')) end
def to_s
def to_s string = "#{self.method.to_s.upcase}".dup string << " #{WebMock::Util::URI.strip_default_port_from_uri_string(self.uri.to_s)}" string << " with body '#{body.to_s}'" if body && body.to_s != '' if headers && !headers.empty? string << " with headers #{WebMock::Util::Headers.sorted_headers_string(headers)}" end string end
def url_encoded?
def url_encoded? !!(headers&.fetch('Content-Type', nil)&.start_with?('application/x-www-form-urlencoded')) end