WebMock adapter fails to pass through non-stubbed multipart requests
When a form/multipart request containing a file field is sent with the WebMock adapter active, the request hangs after sending only the non-file part. See !351 (merged) for a failing test. When running it in Docker, I get
root@87acbea41878:/home# HTTPX_DEBUG=1 bundle exec ruby -Itest regression_tests/bug_1_3_1_1_test.rb
DEPRECATED: use MT_CPU instead of N for parallel test runs
/home/test/support/websocket_test_plugin.rb:4: warning: base64 was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add base64 to your Gemfile or gemspec to silence this warning.
Run options: --seed 58451
# Running:
resolver: query A for nghttp2
resolver: server: udp://127.0.0.11:53...
WRITE: 25 bytes...
READ: 48 bytes...
resolver: answer A nghttp2: [#<IPAddr: IPv4:172.18.0.9/255.255.255.255>]
idle -> idle
Connected to 172.18.0.9 (#5)
<- HEADLINE: "POST /post HTTP/1.1"
<- HEADER: User-Agent: httpx.rb/1.3.1
<- HEADER: Accept: */*
<- HEADER: Accept-Encoding: gzip, deflate
<- HEADER: Content-Type: multipart/form-data; boundary=---------------------b86f5868211517cc6410934ce97d4ed248dc868134
<- HEADER: Content-Length: 871
<- HEADER: Connection: close
<- HEADER: Host: nghttp2
<-
WRITE: 260 bytes...
/home/lib/httpx/loggable.rb:31:in `full_message': Timed out after 1 seconds (HTTPX::RequestTimeoutError)
172.18.0.9 connected -> closed
first test failed: Bug_1_3_1_1_Test#test_webmock_multipart_real_request
E
Finished in 1.039747s, 0.9618 runs/s, 0.0000 assertions/s.
1) Error:
Bug_1_3_1_1_Test#test_webmock_multipart_real_request:
HTTPX::RequestTimeoutError: Timed out after 1 seconds
test/support/assertion_helpers.rb:7:in `verify_status'
regression_tests/bug_1_3_1_1_test.rb:15:in `test_webmock_multipart_real_request'
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
Same test with WebMock commented out passes:
root@87acbea41878:/home# HTTPX_DEBUG=1 bundle exec ruby -Itest regression_tests/bug_1_3_1_1_test.rb
DEPRECATED: use MT_CPU instead of N for parallel test runs
/home/test/support/websocket_test_plugin.rb:4: warning: base64 was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add base64 to your Gemfile or gemspec to silence this warning.
Run options: --seed 26465
# Running:
resolver: query A for nghttp2
resolver: server: udp://127.0.0.11:53...
WRITE: 25 bytes...
READ: 48 bytes...
resolver: answer A nghttp2: [#<IPAddr: IPv4:172.18.0.9/255.255.255.255>]
idle -> idle
Connected to 172.18.0.9 (#6)
<- HEADLINE: "POST /post HTTP/1.1"
<- HEADER: User-Agent: httpx.rb/1.3.1
<- HEADER: Accept: */*
<- HEADER: Accept-Encoding: gzip, deflate
<- HEADER: Content-Type: multipart/form-data; boundary=---------------------8523f1969c80b9e92f0779cadbccb3212b56085425
<- HEADER: Content-Length: 877
<- HEADER: Connection: close
<- HEADER: Host: nghttp2
<-
<- DATA: 877 bytes...
WRITE: 1137 bytes...
READ: 1418 bytes...
-> HEADLINE: 200 HTTP/1.1
-> HEADER: date: Mon, 21 Oct 2024 18:10:56 GMT
-> HEADER: content-type: application/json
-> HEADER: access-control-allow-origin: *
-> HEADER: access-control-allow-credentials: true
-> HEADER: content-length: 1182
-> HEADER: connection: close
-> HEADER: server: nghttpx
-> HEADER: via: 1.1 nghttpx
-> DATA: 1182 bytes...
172.18.0.9 connected -> closed
.
Finished in 0.013884s, 72.0266 runs/s, 72.0266 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips