Sha256: abc0220b36c332c2aee3239fd372a64f70d0f4d36f7138dec0daac2ba1c5839e

Contents?: true

Size: 434 Bytes

Versions: 13

Compression:

Stored size: 434 Bytes

Contents

class Rack::App::Middlewares::HeaderSetter

  def initialize(app, headers)
    @app = app
    @headers = headers.freeze
  end

  def call(env)
    response = rack_response(@app.call(env))

    @headers.each do |header, value|
      response.headers[header] ||= value
    end

    response.finish
  end

  protected

  def rack_response(raw_response)
    Rack::Response.new(raw_response[2], raw_response[0], raw_response[1])
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rack-app-5.0.0 lib/rack/app/middlewares/header_setter.rb
rack-app-5.0.0.rc2 lib/rack/app/middlewares/header_setter.rb
rack-app-5.0.0.rc1 lib/rack/app/middlewares/header_setter.rb
rack-app-4.0.1 lib/rack/app/middlewares/header_setter.rb
rack-app-3.6.0 lib/rack/app/middlewares/header_setter.rb
rack-app-3.5.2 lib/rack/app/middlewares/header_setter.rb
rack-app-3.5.1 lib/rack/app/middlewares/header_setter.rb
rack-app-3.5.0 lib/rack/app/middlewares/header_setter.rb
rack-app-3.4.0 lib/rack/app/middlewares/header_setter.rb
rack-app-3.3.0 lib/rack/app/middlewares/header_setter.rb
rack-app-3.2.1 lib/rack/app/middlewares/header_setter.rb
rack-app-3.2.0 lib/rack/app/middlewares/header_setter.rb
rack-app-3.1.0 lib/rack/app/middlewares/header_setter.rb