Class: Faraday::RequestId

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

Constant Summary collapse

HEADER =
'X-Request-Id'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(app, options = nil) ⇒ RequestId

Returns a new instance of RequestId.



8
9
10
11
# File 'lib/faraday/request_id.rb', line 8

def initialize(app, options = nil)
  super(app)
  @options = options || default_options
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
# File 'lib/faraday/request_id.rb', line 13

def call(env)
  set_header(env) if needs_header?(env)
  @app.call(env)
end