Class: Cannon::Middleware::ContentType
- Inherits:
-
Object
- Object
- Cannon::Middleware::ContentType
- Defined in:
- lib/cannon/middleware/content_type.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ ContentType
constructor
A new instance of ContentType.
- #run(request, response, next_proc) ⇒ Object
Constructor Details
#initialize(app) ⇒ ContentType
Returns a new instance of ContentType.
4 5 6 |
# File 'lib/cannon/middleware/content_type.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#run(request, response, next_proc) ⇒ Object
8 9 10 11 12 |
# File 'lib/cannon/middleware/content_type.rb', line 8 def run(request, response, next_proc) return next_proc.call unless response.headers['Content-Type'].nil? response.headers['Content-Type'] = 'text/plain; charset=us-ascii' next_proc.call end |