alphagov/slimmer — pull request #27 by tomafro (2012-11-13 15:52:01+00:00)
Title: Don't interfere with non-html response bodies.

Trying to get whitehall to serve uploaded attachments using
send_file in rails fails on apps using slimmer. After a fair amount
of debugging, I traced the cause to the use of the Rack::Response
object to query the response. Constructing a Rack::Response starts
building a new response, interacting with the original body in a way
that breaks the Rack::SendFile middleware.

N.B. The included test deliberately doesn't use rack-test (calling
the app directly), as rack-test itself constructs responses and
calls methods on the body - exactly the things we're trying to
prevent.