1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Fix example for custom response filtering in docs

This commit is contained in:
Ilya Baryshev
2015-08-01 11:10:51 +03:00
parent 89cdda86d1
commit 14931dd47a

View File

@@ -417,12 +417,13 @@ that of ``before_record``:
.. code:: python
def scrub_string(string, replacement=''):
def before_record_reponse(response):
return response['body']['string'] = response['body']['string'].replace(string, replacement)
return before_record_reponse
def before_record_response(response):
response['body']['string'] = response['body']['string'].replace(string, replacement)
return response
return before_record_response
my_vcr = vcr.VCR(
before_record_reponse=scrub_string(settings.USERNAME, 'username'),
before_record_response=scrub_string(settings.USERNAME, 'username'),
)
with my_vcr.use_cassette('test.yml'):
# your http code here