Exemple #1
0
    def test_binary_dechunk(self):
        headers = {'Content-Type': 'application/octet-stream',
                   'Transfer-Encoding': 'chunked'}

        content = b''.join(chunk_encode_iter([b'ABCD'] * 10)).decode('utf-8')
        headers, gen, is_rw = self.rewrite_record(headers, content, ts='201701mp_')

        exp = ''.join(['ABCD'] * 10)
        assert b''.join(gen).decode('utf-8') == exp

        assert is_rw == False

        assert ('Transfer-Encoding', 'chunked') not in headers.headers
    def test_binary_dechunk(self):
        headers = {'Content-Type': 'application/octet-stream',
                   'Transfer-Encoding': 'chunked'}

        content = b''.join(chunk_encode_iter([b'ABCD'] * 10)).decode('utf-8')
        headers, gen, is_rw = self.rewrite_record(headers, content, ts='201701mp_')

        exp = ''.join(['ABCD'] * 10)
        assert b''.join(gen).decode('utf-8') == exp

        assert is_rw == False

        assert ('Transfer-Encoding', 'chunked') not in headers.headers