recording_processors.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:azure-python-devtools 作者: Azure 项目源码 文件源码
def process_response(self, response):
        import six
        body = response['body']['string']

        # backward compatibility. under 2.7 response body is unicode, under 3.5 response body is
        # bytes. when set the value back, the same type must be used.
        body_is_string = isinstance(body, six.string_types)

        content_in_string = (response['body']['string'] or b'').decode('utf-8')
        index = content_in_string.find(LargeResponseBodyProcessor.control_flag)

        if index > -1:
            length = int(content_in_string[index + len(LargeResponseBodyProcessor.control_flag):])
            if body_is_string:
                response['body']['string'] = '0' * length
            else:
                response['body']['string'] = bytes([0] * length)

        return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号