Method: VCR::RequestMatcherRegistry#uri_without_params

Defined in:
lib/vcr/request_matcher_registry.rb

#uri_without_params(*ignores) ⇒ #call Also known as: uri_without_param

Builds a dynamic request matcher that matches on a URI while ignoring the named query parameters. This is useful for dealing with non-deterministic URIs (i.e. that have a timestamp or request signature parameter).

Examples:

without_timestamp = VCR.request_matchers.uri_without_param(:timestamp)

# use it directly...
VCR.use_cassette('example', :match_requests_on => [:method, without_timestamp]) { }

# ...or register it as a named matcher
VCR.configure do |c|
  c.register_request_matcher(:uri_without_timestamp, &without_timestamp)
end

VCR.use_cassette('example', :match_requests_on => [:method, :uri_without_timestamp]) { }

Parameters:

  • ignores (Array<#to_s>)

    The names of the query parameters to ignore

Returns:

  • (#call)

    the request matcher



91
92
93
# File 'lib/vcr/request_matcher_registry.rb', line 91

def uri_without_params(*ignores)
  uri_without_param_matchers[ignores]
end