Compressor

This behaviour checks if the request comes with an Accept-Encoding header set to gzip, and in this case it compresses the content. (A Content-Encoding: gzip will show up in the reponse).

The gzip value in the config can have the following values.

  • chunked: will use chunked Transfer-Encoding and will not allow the Content-Length header in the response (TODO: we would need to check how this works when using HTTP2).
  • knownlength: will prevent streaming, it will buffer all the response while compressing it to know the Content-Length of the full response.
  • flex: (not implemented yet), will use buffered response, that will produce a response with Content-Length if Flush is not called by any other part of the behaviour, or chunked if flush is called to send data out.
{
    "name": "compressor", 
    "config": {
        "gzip": "always"
    }
}