1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 17:15:35 +00:00
Files
vcrpy/vcr/matchers.py
Kevin McCarthy a66f462dcd Add support for custom request matchers
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.
2013-09-16 20:46:00 -10:00

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)