'Write to the request, automatically compressing data on the fly.'

def encode(self, data):

    if (not self._request.startedWriting):
        self._request.responseHeaders.removeHeader('content-length')
    return self._zlibCompressor.compress(data)
