Last active
June 10, 2020 14:43
-
-
Save jcrisp/14afba98d7abf236f9f0510b21d94df5 to your computer and use it in GitHub Desktop.
HandleBadEncodingMiddleware
This file contains hidden or 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 HandleBadEncodingMiddleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
begin | |
Rack::Utils.parse_nested_query(env['QUERY_STRING'].to_s) | |
rescue Rack::Utils::InvalidParameterError | |
env['QUERY_STRING'] = '' | |
end | |
@app.call(env) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👏 thanks!