mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
This commit not only changes the default method of matching requests (just match on method and URI instead of the entire request + headers) but also allows the user to add custom matchers.
27 lines
394 B
Python
27 lines
394 B
Python
def method(r1, r2):
|
|
return r1.method == r2.method
|
|
|
|
|
|
def url(r1, r2):
|
|
return r1.url == r2.url
|
|
|
|
|
|
def host(r1, r2):
|
|
return r1.host == r2.host
|
|
|
|
|
|
def path(r1, r2):
|
|
return r1.path == r2.path
|
|
|
|
|
|
def body(r1, r2):
|
|
return r1.body == r2.body
|
|
|
|
|
|
def headers(r1, r2):
|
|
return r1.headers == r2.headers
|
|
|
|
|
|
def requests_match(r1, r2, matchers):
|
|
return all(m(r1, r2) for m in matchers)
|