def test_sendRequestHeaders(self):
        """
        L{Request.writeTo} formats header data and writes it to the given
        transport.
        """
        headers = Headers({b'x-foo': [b'bar', b'baz'],
                           b'host': [b'example.com']})
        Request(b'GET', b'/foo', headers, None).writeTo(self.transport)
        lines = self.transport.value().split(b'\r\n')
        self.assertEqual(lines[0], b"GET /foo HTTP/1.1")
        self.assertEqual(lines[-2:], [b"", b""])
        del lines[0], lines[-2:]
        lines.sort()
        self.assertEqual(
            lines,
            [b"Connection: close",
             b"Host: example.com",
             b"X-Foo: bar",
             b"X-Foo: baz"])

        L{Request.writeTo} formats header data and writes it to the given
        transport.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_newclient.py