Sha256: 8f418e2b284fa67eb6e7a14e31b70ff29f5533182553cc3c45026f83f71f3654
Contents?: true
Size: 576 Bytes
Versions: 43
Compression:
Stored size: 576 Bytes
Contents
require 'rack/utils' module Rack # 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. class ContentType def initialize(app, content_type = "text/html") @app, @content_type = app, content_type end def call(env) status, headers, body = @app.call(env) headers = Utils::HeaderHash.new(headers) headers['Content-Type'] ||= @content_type [status, headers, body] end end end
Version data entries
43 entries across 40 versions & 9 rubygems