Skip to content

Instantly share code, notes, and snippets.

@joho
Created May 2, 2014 22:33
Show Gist options
  • Save joho/0390c92fa369b0ebcf7d to your computer and use it in GitHub Desktop.
Save joho/0390c92fa369b0ebcf7d to your computer and use it in GitHub Desktop.
Fun little middleware I rediscovered in the Goodfilms codebase.
class FuckXmlFoLife
def initialize(app)
@app = app
end
def call(env)
if env["HTTP_ACCEPT"] == 'application/xml'
Rack::Response.new([], 406).finish
else
@app.call(env)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment