Skip to content

Instantly share code, notes, and snippets.

@monteirobrena
Created May 14, 2014 14:24
Show Gist options
  • Save monteirobrena/fbb8805c8530dda39a1b to your computer and use it in GitHub Desktop.
Save monteirobrena/fbb8805c8530dda39a1b to your computer and use it in GitHub Desktop.
Rack::Deflater
# Enable GZIP
use Rack::Deflater
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