'If L{Request} is created with a C{bodyProducer} with a known length,
that length is sent as the value for the I{Content-Length} header and
chunked encoding is not used.'

def test_sendRequestBodyWithLength(self):

    producer = StringProducer(3)
    request = Request('POST', '/bar', _boringHeaders, producer)
    request.writeTo(self.transport)
    self.assertNotIdentical(producer.consumer, None)
    self.assertIdentical(self.transport.producer, producer)
    self.assertTrue(self.transport.streaming)
    self.assertEqual(self.transport.value(), 'POST    /bar    HTTP/1.1\r\nConnection:    close\r\nContent-Length:    3\r\nHost:    example.com\r\n\r\n')
    self.transport.clear()
    producer.consumer.write('abc')
    producer.finished.callback(None)
    self.assertIdentical(self.transport.producer, None)
    self.assertEqual(self.transport.value(), 'abc')
