def _process_response_recording(self, response):
if self.in_recording:
# make header name lower case and filter unwanted headers
headers = {}
for key in response['headers']:
if key.lower() not in self.FILTER_HEADERS:
headers[key.lower()] = response['headers'][key]
response['headers'] = headers
body = response['body']['string']
if body and not isinstance(body, six.string_types):
response['body']['string'] = body.decode('utf-8')
for processor in self.recording_processors:
response = processor.process_response(response)
if not response:
break
else:
for processor in self.replay_processors:
response = processor.process_response(response)
if not response:
break
return response
评论列表
文章目录