Only default puma options to queue_requests: false if ssl is specified

This commit is contained in:
Thomas Walpole 2019-07-23 12:05:16 -07:00
parent 66c1583568
commit eb8fe55b99
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ Capybara.register_server :puma do |app, port, host, **options|
# If we just run the Puma Rack handler it installs signal handlers which prevent us from being able to interrupt tests.
# Therefore construct and run the Server instance ourselves.
# Rack::Handler::Puma.run(app, { Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false }.merge(options))
options = { Host: host, Port: port, Threads: '0:4', workers: 0, daemon: false, queue_requests: false }.merge(options)
default_options = { Host: host, Port: port, Threads: '0:4', workers: 0, daemon: false, queue_requests: false }
default_options[:queue_requests] = false if options[:Host]&.start_with?('ssl://')
options = default_options.merge(options)
conf = Rack::Handler::Puma.config(app, options)
events = conf.options[:Silent] ? ::Puma::Events.strings : ::Puma::Events.stdio