mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 09:35:34 +00:00
Fix example for custom response filtering in docs
This commit is contained in:
@@ -417,12 +417,13 @@ that of ``before_record``:
|
|||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
def scrub_string(string, replacement=''):
|
def scrub_string(string, replacement=''):
|
||||||
def before_record_reponse(response):
|
def before_record_response(response):
|
||||||
return response['body']['string'] = response['body']['string'].replace(string, replacement)
|
response['body']['string'] = response['body']['string'].replace(string, replacement)
|
||||||
return before_record_reponse
|
return response
|
||||||
|
return before_record_response
|
||||||
|
|
||||||
my_vcr = vcr.VCR(
|
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'):
|
with my_vcr.use_cassette('test.yml'):
|
||||||
# your http code here
|
# your http code here
|
||||||
|
|||||||
Reference in New Issue
Block a user