httpx/regression_tests/bug_0_14_5_test.rb
HoneyryderChuck 092e594a4b Request.verb is now an upcased string (ex: "GET")
The reference for a request verb is now the string which is used
everywhere else, instead of the symbol corresponding to it. This was an
artifact from the import from httprb, and there is no advantage in it,
since these strings are frozen in most use cases, and the
transformations from symbol to strings being performed everywhere are
prooof that keeping the atom isn't really bringing any benefit.
2023-04-17 16:54:31 +03:00

40 lines
1.1 KiB
Ruby

# frozen_string_literal: true
require "test_helper"
require "support/http_helpers"
class Bug_0_14_5_Test < Minitest::Test
include HTTPHelpers
def test_http2_post_with_concurrent_post_requests_with_large_payload_blocking
post_uri = "https://#{httpbin}/post"
HTTPX.wrap do |http|
# this is necesary, so that handshake phase is complete
http.get("https://#{httpbin}/get")
requests = 2.times.map do
http.build_request("POST", post_uri, body: "a" * (1 << 16)) # 65k body, must be above write buffer size
end
responses = http.request(*requests)
responses.each do |response|
verify_status(response, 200)
body = json_body(response)
verify_header(body["headers"], "Content-Type", "application/octet-stream")
verify_uploaded(body, "data", "a" * (1 << 16))
end
end
rescue MinitestExtensions::TimeoutForTest::TestTimeout => e
ex = RegressionError.new(e.message)
ex.set_backtrace(e.backtrace)
raise ex
end
private
def origin(orig = httpbin)
"http://#{orig}"
end
end