A transformation is like a filter applied to the response generated by your application.

Transformations can be chained (the output of a transformation will be the input of the following one) and can completely overwrite
response headers.

The most common example of transformation is gzip encoding. The output of your application is passed to a function compressing it with gzip
and setting the Content-Encoding header. This feature rely on 2 external packages: libpcre3-dev, libz-dev on Ubuntu.

[uwsgi]plugin=python,transformation_gziphttp-socket=:9090; load the werkzeug test appmodule=werkzeug.testapp:test_app; if the client supports gzip encoding goto to the gzipperroute-if=contains:${HTTP_ACCEPT_ENCODING};gzip goto:mygzipperroute-run=last:route-label=mygzipper; pass the response to the gzip transformationroute=^/$ gzip:

The cachestore routing instruction is a transformation too, so you can cache various states of the response.

[uwsgi]plugin=python,transformation_gziphttp-socket=:9090; load the werkezeug test appmodule=werkzeug.testapp:test_app; create a cache of 100 itemscache=100; if the client support gzip encoding goto to the gzipperroute-if=contains:${HTTP_ACCEPT_ENCODING};gzip goto:mygzipperroute=^/$ cache:key=werkzeug_homepageroute=^/$ cachestore:key=werkzeug_homepageroute-run=last:route-label=mygzipperroute=^/$ cache:key=werkzeug_homepage.gz; first cache the 'clean' response (for client not supporting gzip)route=^/$ cachestore:key=werkzeug_homepage; then pass the response to the gzip transformationroute=^/$ gzip:; and cache it again in another item (gzipped)route=^/$ cachestore:key=werkzeug_homepage.gz

Another common transformation is applying stylesheets to XML files. (see The XSLT plugin)

Each transformation announces itself as a “streaming” one or a “buffering” one.

Streaming ones are transformations that can be applied to response chunks (parts). An example of a streaming transformation
is gzip (you do not need the whole body to begin compressing it). Buffering transformations are those requiring the full body before applying something to it. XSLT is an example of buffering transformation. Another example of buffering transformations are those used for storing response in some kind of cache.

If your whole pipeline is composed by only “streaming” transformations, your client will receive the output chunk by chunk. On the other hand
a single buffering transformation will make the whole pipeline buffered, so your client will get the output only at the end.