Class: Katello::PreventJsonParsing

Inherits:
Object
  • Object
show all
Defined in:
lib/katello/prevent_json_parsing.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, exclude) ⇒ PreventJsonParsing

Returns a new instance of PreventJsonParsing.



3
4
5
6
# File 'lib/katello/prevent_json_parsing.rb', line 3

def initialize(app, exclude)
  @app = app
  @exclude = exclude
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
# File 'lib/katello/prevent_json_parsing.rb', line 8

def call(env)
  if @exclude&.call(env)
    env['CONTENT_TYPE'] = 'text/plain'
  end
  @app.call(env)
end