Class: Faraday::Conductivity::RequestHeaders

Inherits:
Middleware
  • Object
show all
Defined in:
lib/faraday/conductivity/request_headers.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, headers) ⇒ RequestHeaders

Returns a new instance of RequestHeaders.



5
6
7
8
# File 'lib/faraday/conductivity/request_headers.rb', line 5

def initialize(app, headers)
  super(app)
  @headers = headers
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
# File 'lib/faraday/conductivity/request_headers.rb', line 10

def call(env)
  @headers.each do |header, value|
    env[:request_headers][header] ||= value
  end
  @app.call(env)
end