Class: HttpClientGenerator::Plugs::SetRequestid
- Inherits:
-
Object
- Object
- HttpClientGenerator::Plugs::SetRequestid
- Defined in:
- lib/http_client_generator/plugs/set_request_id.rb
Instance Method Summary collapse
- #call(req) ⇒ Object
-
#initialize(header_name) ⇒ SetRequestid
constructor
A new instance of SetRequestid.
Constructor Details
#initialize(header_name) ⇒ SetRequestid
Returns a new instance of SetRequestid.
10 11 12 |
# File 'lib/http_client_generator/plugs/set_request_id.rb', line 10 def initialize(header_name) @header_name = header_name end |
Instance Method Details
#call(req) ⇒ Object
14 15 16 17 |
# File 'lib/http_client_generator/plugs/set_request_id.rb', line 14 def call(req) req.headers[@header_name] = req.rest_args[:request_id] || SecureRandom.uuid req end |