def test_existingHeaders(self):
        """
        If there are existing I{Accept-Encoding} fields,
        L{client.ContentDecoderAgent} creates a new field for the decoders it
        knows about.
        """
        headers = http_headers.Headers({b'foo': [b'bar'],
                                        b'accept-encoding': [b'fizz']})
        agent = client.ContentDecoderAgent(
            self.agent, [(b'decoder1', Decoder1), (b'decoder2', Decoder2)])
        agent.request(b'GET', b'http://example.com/foo', headers=headers)

        protocol = self.protocol

        self.assertEqual(len(protocol.requests), 1)
        req, res = protocol.requests.pop()
        self.assertEqual(
            list(sorted(req.headers.getAllRawHeaders())),
            [(b'Accept-Encoding', [b'fizz', b'decoder1,decoder2']),
             (b'Foo', [b'bar']),
             (b'Host', [b'example.com'])])

        If there are existing I{Accept-Encoding} fields,
        L{client.ContentDecoderAgent} creates a new field for the decoders it
        knows about.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_agent.py