1 # frozen_string_literal: true
3 require_relative 'constants'
4 require_relative 'utils'
8 # Sets the content-type header on responses which don't have one.
11 # use Rack::ContentType, "text/plain"
13 # When no content type argument is provided, "text/html" is the
18 def initialize(app, content_type = "text/html")
20 @content_type = content_type
24 status, headers, _ = response = @app.call(env)
26 unless STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i)
27 headers[CONTENT_TYPE] ||= @content_type