Class Rack::Deflater
In: lib/rack/deflater.rb
Parent: Object

This middleware enables compression of http responses.

Currently supported compression algorithms:

  * gzip
  * deflate
  * identity (no transformation)

The middleware automatically detects when compression is supported and allowed. For example no transformation is made when a cache directive of ‘no-transform’ is present, or when the response status code is one that doesn‘t allow an entity body.

Methods

call   new  

Classes and Modules

Class Rack::Deflater::DeflateStream
Class Rack::Deflater::GzipStream

Public Class methods

Creates Rack::Deflater middleware.

app
rack app instance
options
hash of deflater options, i.e. ‘if’ - a lambda enabling / disabling deflation based on returned boolean value
       e.g use Rack::Deflater, :if => lambda { |env, status, headers, body| body.length > 512 }

‘include’ - a list of content types that should be compressed

Public Instance methods

[Validate]