Sha256: 31998dcfa14560759a08bea1bb14c5333d15af715193708a10a1d0808d1864f5
Contents?: true
Size: 1.37 KB
Versions: 11
Compression:
Stored size: 1.37 KB
Contents
describe FastlyRails::Rack::RemoveSetCookieHeader do it "removes 'set-cookie' header if 'surrogate-control' header present" do headers = { "Surrogate-Control" => "test", "Set-Cookie" => "NOOO" } app = Rack::Builder.new do use FastlyRails::Rack::RemoveSetCookieHeader run lambda { |env| Rack::Response.new("", 200, headers).finish } end env = Rack::MockRequest.env_for('/') response = Rack::MockResponse.new(*app.call(env)) assert_nil response.headers['Set-Cookie'] end it "removes 'set-cookie' header if 'surrogate-key' header present" do headers = { "Surrogate-Key" => "test", "Set-Cookie" => "NOOO" } app = Rack::Builder.new do use FastlyRails::Rack::RemoveSetCookieHeader run lambda { |env| Rack::Response.new("", 200, headers).finish } end env = Rack::MockRequest.env_for('/') response = Rack::MockResponse.new(*app.call(env)) assert_nil response.headers['Set-Cookie'] end it "keeps 'set-cookie' if no 'surrogate-control' or 'surrogate-key'" do headers = { "Set-Cookie" => "yes!!" } app = Rack::Builder.new do use FastlyRails::Rack::RemoveSetCookieHeader run lambda { |env| Rack::Response.new("", 200, headers).finish } end env = Rack::MockRequest.env_for('/') response = Rack::MockResponse.new(*app.call(env)) assert_equal response.headers['Set-Cookie'], "yes!!" end end
Version data entries
11 entries across 11 versions & 1 rubygems