Sha256: 1f4aa614a2bbe0fcda79ba4e5366fc8a591712b65b0199347d7a537e4997b6a5
Contents?: true
Size: 1.06 KB
Versions: 5
Compression:
Stored size: 1.06 KB
Contents
module WebMock class RequestSignature attr_accessor :method, :uri, :body attr_reader :headers def initialize(method, uri, options = {}) self.method = method self.uri = uri.is_a?(Addressable::URI) ? uri : WebMock::Util::URI.normalize_uri(uri) assign_options(options) end def to_s string = "#{self.method.to_s.upcase}" 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 headers=(headers) @headers = WebMock::Util::Headers.normalize_headers(headers) end def hash self.to_s.hash end def eql?(other) self.to_s == other.to_s end private def assign_options(options) self.body = options[:body] if options.has_key?(:body) self.headers = options[:headers] if options.has_key?(:headers) end end end
Version data entries
5 entries across 5 versions & 2 rubygems