Class: Rack::ContentType
- Inherits:
-
Object
- Object
- Rack::ContentType
- Includes:
- Utils
- Defined in:
- rack/rack/content_type.rb
Overview
Sets the Content-Type header on responses which don't have one.
Builder Usage: use Rack::ContentType, "text/plain"
When no content type argument is provided, "text/html" is assumed.
Constant Summary
Class Attribute Summary (collapse)
-
+ (void) key_space_limit
extended
from Utils
Returns the value of attribute key_space_limit.
Instance Method Summary (collapse)
- - (void) call(env)
-
- (ContentType) initialize(app, content_type = "text/html")
constructor
A new instance of ContentType.
Constructor Details
- (ContentType) initialize(app, content_type = "text/html")
Returns a new instance of ContentType
14 15 16 |
# File 'rack/rack/content_type.rb', line 14 def initialize(app, content_type = "text/html") @app, @content_type = app, content_type end |
Class Attribute Details
+ (void) key_space_limit Originally defined in module Utils
Returns the value of attribute key_space_limit
Instance Method Details
- (void) call(env)
18 19 20 21 22 23 24 25 26 27 |
# File 'rack/rack/content_type.rb', line 18 def call(env) status, headers, body = @app.call(env) headers = Utils::HeaderHash.new(headers) unless STATUS_WITH_NO_ENTITY_BODY.include?(status) headers['Content-Type'] ||= @content_type end [status, headers, body] end |