Created
May 14, 2014 14:24
-
-
Save monteirobrena/fbb8805c8530dda39a1b to your computer and use it in GitHub Desktop.
Rack::Deflater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable GZIP | |
use Rack::Deflater |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe Rack::Deflater do | |
it "produces an identical eTag whether content is deflated or not" do | |
get "/api/acme" | |
expect(response.headers["Content-Encoding"]).to be_nil | |
etag = response.headers["Etag"] | |
content_length = response.headers["Content-Length"].to_i | |
get "/api/acme", {}, { "HTTP_ACCEPT_ENCODING" => "gzip" } | |
expect(response.headers["Etag"]).to eql(etag) | |
expect(response.headers["Content-Length"].to_i).to_not eql(content_length) | |
expect(response.headers).to have_key("Content-Encoding") | |
expect(response.headers["Content-Encoding"]).to eql("gzip") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment