Last active
August 29, 2015 14:02
-
-
Save NZKoz/fdc4f6bd57c2709f7813 to your computer and use it in GitHub Desktop.
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
config.middleware.use "OldAcceptBehaviour", ["text/html", "application/xml", "text/javascript", "application/atom+xml"] |
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
class OldAcceptBehaviour | |
def initialize(app, formats) | |
@app = app | |
@formats = formats | |
end | |
def call(env) | |
current_accept_header = env["HTTP_ACCEPT"] | |
if [email protected]?(current_accept_header) && !env["HTTP_X_REQUESTED_WITH"] | |
env["HTTP_ACCEPT"] = "text/html" | |
end | |
@app.call(env) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment