Class: WebMock::URIStringPattern
Instance Method Summary
collapse
Methods inherited from URIPattern
#initialize
#rSpecHashExcludingMatcher?, #rSpecHashIncludingMatcher?
Instance Method Details
#add_query_params(query_params) ⇒ Object
204
205
206
207
208
209
210
211
|
# File 'lib/webmock/request_pattern.rb', line 204
def add_query_params(query_params)
super
if @query_params.is_a?(Hash) || @query_params.is_a?(String)
query_hash = (WebMock::Util::QueryMapper.query_to_values(@pattern.query, notation: Config.instance.query_values_notation) || {}).merge(@query_params)
@pattern.query = WebMock::Util::QueryMapper.values_to_query(query_hash, notation: WebMock::Config.instance.query_values_notation)
@query_params = nil
end
end
|
#matches?(uri) ⇒ Boolean
191
192
193
194
195
196
197
198
199
200
201
202
|
# File 'lib/webmock/request_pattern.rb', line 191
def matches?(uri)
if @pattern.is_a?(Addressable::URI)
if @query_params
uri.omit(:query) === @pattern &&
(@query_params.nil? || @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query, notation: Config.instance.query_values_notation))
else
uri === @pattern
end
else
false
end
end
|