lib/pact/consumer/server.rb in pact-mock_service-2.12.0 vs lib/pact/consumer/server.rb in pact-mock_service-3.0.0

- old
+ new

@@ -32,16 +32,17 @@ def ports @ports ||= {} end end - attr_reader :app, :port, :options + attr_reader :app, :host, :port, :options - def initialize(app, port, options = {}) + def initialize(app, host, port, options = {}) @app = app @middleware = Middleware.new(@app) @server_thread = nil + @host = host @port = port @options = options end def reset_error! @@ -50,14 +51,10 @@ def error @middleware.error end - def host - "localhost" - end - def responsive? return false if @server_thread && @server_thread.join(0) res = get_identity if res.is_a?(Net::HTTPSuccess) or res.is_a?(Net::HTTPRedirection) return res.body == @app.object_id.to_s @@ -94,10 +91,10 @@ opts.merge!(ssl_opts) if options[:ssl] opts end def ssl_opts - { SSLEnable: true, SSLCertName: [ %w[CN localhost] ] } + { SSLEnable: true, SSLCertName: [ ["CN", host] ] } end def boot unless responsive? @server_thread = Thread.new { run_default_server(@middleware, @port) }