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.
8 9 10 |
# File 'lib/http_client_generator/plugs/set_request_id.rb', line 8 def initialize(header_name) @header_name = header_name end |
Instance Method Details
#call(req) ⇒ Object
12 13 14 15 |
# File 'lib/http_client_generator/plugs/set_request_id.rb', line 12 def call(req) req.headers[@header_name] = req.rest_args[:request_id] || SecureRandom.uuid req end |