Class: Goliath::Chimp::Rack::ForceContentType

Inherits:
Object
  • Object
show all
Defined in:
lib/goliath/chimp/rack/force_content_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, content_type) ⇒ ForceContentType

Returns a new instance of ForceContentType.



7
8
9
# File 'lib/goliath/chimp/rack/force_content_type.rb', line 7

def initialize(app, content_type)
  @app = app ; @content_type = content_type
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



5
6
7
# File 'lib/goliath/chimp/rack/force_content_type.rb', line 5

def content_type
  @content_type
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
# File 'lib/goliath/chimp/rack/force_content_type.rb', line 11

def call env
  env['CONTENT_TYPE'] = env['HTTP_ACCEPT'] = content_type
  @app.call env
end