class WebMock::URIStringPattern

Public Instance Methods

add_query_params(query_params) click to toggle source
# File lib/webmock/request_pattern.rb, line 134
def add_query_params(query_params)
  super
  if @query_params.is_a?(Hash) || @query_params.is_a?(String)
    @pattern.query_values = (@pattern.query_values || {}).merge(@query_params)
    @query_params = nil
  end
end
matches?(uri) click to toggle source
# File lib/webmock/request_pattern.rb, line 122
def matches?(uri)
  if @pattern.is_a?(Addressable::URI)
    if @query_params
      uri.omit(:query) === @pattern && (@query_params.nil? || @query_params == uri.query_values)
    else
      uri === @pattern
    end
  else
    false
  end
end
to_s() click to toggle source
# File lib/webmock/request_pattern.rb, line 142
def to_s
  str = WebMock::Util::URI.strip_default_port_from_uri_string(@pattern.to_s)
  str += " with query params #{@query_params.inspect}" if @query_params
  str
end