Class: Sbmt::Pact::Provider::MessageProviderServlet
- Inherits:
-
WEBrick::HTTPServlet::ProcHandler
- Object
- WEBrick::HTTPServlet::ProcHandler
- Sbmt::Pact::Provider::MessageProviderServlet
- Defined in:
- lib/sbmt/pact/provider/message_provider_servlet.rb
Constant Summary collapse
- CONTENT_TYPE_JSON =
"application/json"
- CONTENT_TYPE_PROTO =
"application/protobuf"
- METADATA_HEADER =
"pact-message-metadata"
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #add_message_handler(name, &block) ⇒ Object
-
#initialize(logger: Logger.new($stdout)) ⇒ MessageProviderServlet
constructor
A new instance of MessageProviderServlet.
Constructor Details
#initialize(logger: Logger.new($stdout)) ⇒ MessageProviderServlet
Returns a new instance of MessageProviderServlet.
15 16 17 18 19 20 21 |
# File 'lib/sbmt/pact/provider/message_provider_servlet.rb', line 15 def initialize(logger: Logger.new($stdout)) super(build_proc) @message_handlers = {} @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
9 10 11 |
# File 'lib/sbmt/pact/provider/message_provider_servlet.rb', line 9 def logger @logger end |
Instance Method Details
#add_message_handler(name, &block) ⇒ Object
23 24 25 26 27 |
# File 'lib/sbmt/pact/provider/message_provider_servlet.rb', line 23 def (name, &block) raise "message handler for #{name} already configured" if @message_handlers[name].present? @message_handlers[name] = {proc: block} end |