#NEWLINE# def test_sendChunkedRequestBody( self ) : #NEWLINE# #INDENT# '\n        L{Request.writeTo} uses chunked encoding to write data from the request\n        body producer to the given transport.  It registers the request body\n        producer with the transport.\n        ' #NEWLINE# producer = StringProducer ( UNKNOWN_LENGTH ) #NEWLINE# request = Request ( b'POST' , b'/bar' , _boringHeaders , producer ) #NEWLINE# request . writeTo ( self . transport ) #NEWLINE# self . assertNotIdentical ( producer . consumer , None ) #NEWLINE# self . assertIdentical ( producer . transport . producer , producer ) #NEWLINE# self . assertTrue ( self . transport . streaming ) #NEWLINE# self . assertEqual ( self . transport . value ( ) , b'POST /bar HTTP/1.1\r\nConnection: close\r\nTransfer-Encoding: chunked\r\nHost: example.com\r\n\r\n' ) #NEWLINE# self . transport . clear ( ) #NEWLINE# producer . consumer . write ( ( b'x' * 3 ) ) #NEWLINE# producer . consumer . write ( ( b'y' * 15 ) ) #NEWLINE# producer . finished . callback ( None ) #NEWLINE# self . assertIdentical ( self . transport . producer , None ) #NEWLINE# self . assertEqual ( self . transport . value ( ) , b'3\r\nxxx\r\nf\r\nyyyyyyyyyyyyyyy\r\n0\r\n\r\n' )