Parent

Methods

Included Modules

Class Index [+]

Quicksearch

Rack::ContentType

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.

Public Class Methods

new(app, content_type = "text/html") click to toggle source
    # File lib/rack/content_type.rb, line 14
14:     def initialize(app, content_type = "text/html")
15:       @app, @content_type = app, content_type
16:     end

Public Instance Methods

call(env) click to toggle source
    # File lib/rack/content_type.rb, line 18
18:     def call(env)
19:       status, headers, body = @app.call(env)
20:       headers = Utils::HeaderHash.new(headers)
21: 
22:       unless STATUS_WITH_NO_ENTITY_BODY.include?(status)
23:         headers['Content-Type'] ||= @content_type
24:       end
25: 
26:       [status, headers, body]
27:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.