Skip to content

Instantly share code, notes, and snippets.

@fidothe
Created July 11, 2011 16:40
Show Gist options
  • Save fidothe/1076241 to your computer and use it in GitHub Desktop.
Save fidothe/1076241 to your computer and use it in GitHub Desktop.
Stop getting confused by cookies by making your app cookie-blind
class Cookieblind
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
unless request.post?
env.delete("HTTP_COOKIE")
end
begin
status, headers, body = @app.call(env)
rescue Exception => e
Rails.logger.error e.backtrace.join("\n")
raise e
end
response = Rack::Response.new(body, status, headers)
unless request.post?
response.header['Set-Cookie'] = "";
end
response.finish
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment