OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#54293] Test HTTPX persistent conenction bug.
Pavel Balashouaf2f6df0f0cb
diff --git a/spec/httpx_spec.rb b/spec/httpx_spec.rbnew file mode 100644index 00000000000..82208747e9e--- /dev/null+++ b/spec/httpx_spec.rb@@ -0,0 +1,29 @@+require 'webrick'+require 'httpx'++RSpec.describe 'HTTPX' do+ describe 'persistent connections' do+ it 'does not hang forever when used to request HTTP 1.1 server' do+ server = WEBrick::HTTPServer.new(:Port => 8543)+ server.mount_proc '/' do |req, res|+ res.body = 'Response Body'+ end++ Thread.new { server.start }+ session = HTTPX .plugin(:persistent).with(timeout: {keep_alive_timeout: 2})+ number_of_requests_made = 0+ begin+ Timeout.timeout(10) do+ session.post("http://localhost:8543")+ number_of_requests_made += 1+ sleep 4+ session.post("http://localhost:8543")+ number_of_requests_made += 1+ end+ ensure+ expect(number_of_requests_made).to eq(2)+ server.shutdown+ end+ end+ end+end