def test_handle_request_simple(self):

    def wsgi_app(env, start):
        start('200 OK', [('Content-Type', 'text/plain')])
        return [b'data']
    stream = asyncio.StreamReader(loop=self.loop)
    stream.feed_data(b'data')
    stream.feed_eof()
    self.message = protocol.RawRequestMessage('GET', '/path', (1, 1), self.headers, self.raw_headers, True, 'deflate')
    srv = self._make_srv(wsgi_app, readpayload=True)
    self.loop.run_until_complete(srv.handle_request(self.message, self.payload))
    content = b''.join([c[1][0] for c in self.writer.write.mock_calls])
    self.assertTrue(content.startswith(b'HTTP/1.1 200 OK'))
    self.assertTrue(content.endswith(b'data\r\n0\r\n\r\n'))
    self.assertFalse(srv._keep_alive)
def test_handle_request_simple(self):

    def wsgi_app(env, start):
        start('200 OK', [('Content-Type', 'text/plain')])
        return [b'data']
    stream = asyncio.StreamReader(loop=self.loop)
    stream.feed_data(b'data')
    stream.feed_eof()
    self.message = protocol.RawRequestMessage('GET', '/path', (1, 1), self.headers, self.raw_headers, True, 'deflate')
    srv = self._make_srv(wsgi_app, readpayload=True)
    self.loop.run_until_complete(srv.handle_request(self.message, self.payload))
    content = b.join([c[1][0] for c in self.writer.write.mock_calls])
    self.assertTrue(content.startswith(b'HTTP/1.1 200 OK'))
    self.assertTrue(content.endswith(b'data\r\n0\r\n\r\n'))
    self.assertFalse(srv._keep_alive)