Class: Rack::PactBroker::AddPactBrokerVersionHeader
- Inherits:
-
Object
- Object
- Rack::PactBroker::AddPactBrokerVersionHeader
- Defined in:
- lib/rack/pact_broker/add_pact_broker_version_header.rb
Constant Summary collapse
- X_PACT_BROKER_VERSION =
"X-Pact-Broker-Version".freeze
Instance Method Summary collapse
- #add_version_header(headers) ⇒ Object
- #call(env) ⇒ Object
-
#initialize(app) ⇒ AddPactBrokerVersionHeader
constructor
A new instance of AddPactBrokerVersionHeader.
Constructor Details
#initialize(app) ⇒ AddPactBrokerVersionHeader
Returns a new instance of AddPactBrokerVersionHeader.
9 10 11 |
# File 'lib/rack/pact_broker/add_pact_broker_version_header.rb', line 9 def initialize app @app = app end |
Instance Method Details
#add_version_header(headers) ⇒ Object
18 19 20 |
# File 'lib/rack/pact_broker/add_pact_broker_version_header.rb', line 18 def add_version_header headers headers.merge(X_PACT_BROKER_VERSION => ::PactBroker::VERSION) end |
#call(env) ⇒ Object
13 14 15 16 |
# File 'lib/rack/pact_broker/add_pact_broker_version_header.rb', line 13 def call env response = @app.call(env) [response[0], add_version_header(response[1]), response[2]] end |