Skip to content

Instantly share code, notes, and snippets.

@jcrisp
Last active June 10, 2020 14:43
Show Gist options
  • Save jcrisp/14afba98d7abf236f9f0510b21d94df5 to your computer and use it in GitHub Desktop.
Save jcrisp/14afba98d7abf236f9f0510b21d94df5 to your computer and use it in GitHub Desktop.
HandleBadEncodingMiddleware
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
@patriciojofre
Copy link

👏 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment