mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-07-15 00:00:55 -04:00
Compare commits
8 Commits
2eb8185123
...
84f5b303f2
Author | SHA1 | Date | |
---|---|---|---|
|
84f5b303f2 | ||
|
f12c90f0ea | ||
|
36c840ba5c | ||
|
1f946fe66e | ||
|
8dae534bd0 | ||
|
2e7d33f917 | ||
|
0c9fcdb60a | ||
|
cd93bddc2f |
@ -27,11 +27,6 @@ variables:
|
|||||||
paths:
|
paths:
|
||||||
- coverage/
|
- coverage/
|
||||||
|
|
||||||
.jit_matrix: &jit_matrix
|
|
||||||
parallel:
|
|
||||||
matrix:
|
|
||||||
- RUBYOPT: ["", "--jit --jit-warnings --jit-wait"]
|
|
||||||
|
|
||||||
.yjit_matrix: &yjit_matrix
|
.yjit_matrix: &yjit_matrix
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
@ -76,19 +71,16 @@ test ruby 2/5:
|
|||||||
./spec.sh ruby 2.5
|
./spec.sh ruby 2.5
|
||||||
test ruby 2/6:
|
test ruby 2/6:
|
||||||
<<: *test_settings
|
<<: *test_settings
|
||||||
<<: *jit_matrix
|
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
script:
|
script:
|
||||||
./spec.sh ruby 2.6
|
./spec.sh ruby 2.6
|
||||||
test ruby 2/7:
|
test ruby 2/7:
|
||||||
<<: *test_settings
|
<<: *test_settings
|
||||||
<<: *jit_matrix
|
|
||||||
script:
|
script:
|
||||||
./spec.sh ruby 2.7
|
./spec.sh ruby 2.7
|
||||||
test ruby 3/0:
|
test ruby 3/0:
|
||||||
<<: *test_settings
|
<<: *test_settings
|
||||||
<<: *jit_matrix
|
|
||||||
script:
|
script:
|
||||||
./spec.sh ruby 3.0
|
./spec.sh ruby 3.0
|
||||||
test ruby 3/1:
|
test ruby 3/1:
|
||||||
@ -96,6 +88,11 @@ test ruby 3/1:
|
|||||||
<<: *yjit_matrix
|
<<: *yjit_matrix
|
||||||
script:
|
script:
|
||||||
./spec.sh ruby 3.1
|
./spec.sh ruby 3.1
|
||||||
|
test ruby 3/2:
|
||||||
|
<<: *test_settings
|
||||||
|
<<: *yjit_matrix
|
||||||
|
script:
|
||||||
|
./spec.sh ruby 3.2
|
||||||
test truffleruby:
|
test truffleruby:
|
||||||
<<: *test_settings
|
<<: *test_settings
|
||||||
script:
|
script:
|
||||||
@ -108,7 +105,7 @@ coverage:
|
|||||||
variables:
|
variables:
|
||||||
BUNDLE_WITHOUT: test:assorted
|
BUNDLE_WITHOUT: test:assorted
|
||||||
|
|
||||||
image: "ruby:3.1"
|
image: "ruby:3.2"
|
||||||
script:
|
script:
|
||||||
- gem install simplecov --no-doc
|
- gem install simplecov --no-doc
|
||||||
# this is a workaround, because simplecov doesn't support relative paths.
|
# this is a workaround, because simplecov doesn't support relative paths.
|
||||||
@ -130,7 +127,7 @@ docs:
|
|||||||
stage: deploy
|
stage: deploy
|
||||||
needs:
|
needs:
|
||||||
- coverage
|
- coverage
|
||||||
image: "ruby:3.1"
|
image: "ruby:3.2"
|
||||||
before_script:
|
before_script:
|
||||||
- gem install hanna-nouveau
|
- gem install hanna-nouveau
|
||||||
script:
|
script:
|
||||||
|
27
docker-compose-ruby-3.2.yml
Normal file
27
docker-compose-ruby-3.2.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
httpx:
|
||||||
|
image: ruby:3.1
|
||||||
|
environment:
|
||||||
|
- HTTPBIN_COALESCING_HOST=another
|
||||||
|
- HTTPX_RESOLVER_URI=https://doh/dns-query
|
||||||
|
links:
|
||||||
|
- "nghttp2:another"
|
||||||
|
depends_on:
|
||||||
|
- doh
|
||||||
|
|
||||||
|
doh:
|
||||||
|
image: registry.gitlab.com/os85/httpx/nghttp2:1
|
||||||
|
depends_on:
|
||||||
|
- doh-proxy
|
||||||
|
entrypoint:
|
||||||
|
/usr/local/bin/nghttpx
|
||||||
|
volumes:
|
||||||
|
- ./test/support/ci:/home
|
||||||
|
command:
|
||||||
|
--conf /home/doh-nghttp.conf --no-ocsp --frontend '*,443'
|
||||||
|
|
||||||
|
doh-proxy:
|
||||||
|
image: publicarray/doh-proxy
|
||||||
|
environment:
|
||||||
|
- "UNBOUND_SERVICE_HOST=127.0.0.11"
|
@ -210,10 +210,14 @@ module Faraday
|
|||||||
if parallel?(env)
|
if parallel?(env)
|
||||||
handler = env[:parallel_manager].enqueue(env)
|
handler = env[:parallel_manager].enqueue(env)
|
||||||
handler.on_response do |response|
|
handler.on_response do |response|
|
||||||
response.raise_for_status
|
if response.is_a?(::HTTPX::Response)
|
||||||
save_response(env, response.status, response.body.to_s, response.headers, response.reason) do |response_headers|
|
save_response(env, response.status, response.body.to_s, response.headers, response.reason) do |response_headers|
|
||||||
response_headers.merge!(response.headers)
|
response_headers.merge!(response.headers)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
env[:error] = response.error
|
||||||
|
save_response(env, 0, "", {}, nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return handler
|
return handler
|
||||||
end
|
end
|
||||||
@ -229,6 +233,7 @@ module Faraday
|
|||||||
request.response_on_data = env.request.on_data if env.request.stream_response?
|
request.response_on_data = env.request.on_data if env.request.stream_response?
|
||||||
|
|
||||||
response = session.request(request)
|
response = session.request(request)
|
||||||
|
# do not call #raise_for_status for HTTP 4xx or 5xx, as faraday has a middleware for that.
|
||||||
response.raise_for_status unless response.is_a?(::HTTPX::Response)
|
response.raise_for_status unless response.is_a?(::HTTPX::Response)
|
||||||
save_response(env, response.status, response.body.to_s, response.headers, response.reason) do |response_headers|
|
save_response(env, response.status, response.body.to_s, response.headers, response.reason) do |response_headers|
|
||||||
response_headers.merge!(response.headers)
|
response_headers.merge!(response.headers)
|
||||||
|
@ -29,6 +29,22 @@ class FaradayTest < Minitest::Test
|
|||||||
assert_equal "OK", resp2.reason_phrase
|
assert_equal "OK", resp2.reason_phrase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_adapter_in_parallel_errors
|
||||||
|
resp1 = nil
|
||||||
|
|
||||||
|
connection = create_connection
|
||||||
|
connection.in_parallel do
|
||||||
|
resp1 = connection.get("http://wfijojsfsoijf")
|
||||||
|
assert connection.in_parallel?
|
||||||
|
assert_nil resp1.reason_phrase
|
||||||
|
end
|
||||||
|
assert !connection.in_parallel?
|
||||||
|
assert_equal 0, resp1.status
|
||||||
|
assert_nil resp1.reason_phrase
|
||||||
|
assert_equal "", resp1.body
|
||||||
|
refute_nil resp1.env[:error]
|
||||||
|
end
|
||||||
|
|
||||||
def test_adapter_get_handles_compression
|
def test_adapter_get_handles_compression
|
||||||
res = get(build_path("/gzip"))
|
res = get(build_path("/gzip"))
|
||||||
assert JSON.parse(res.body.to_s)["gzipped"]
|
assert JSON.parse(res.body.to_s)["gzipped"]
|
||||||
|
@ -82,7 +82,7 @@ if [[ ${RUBY_VERSION:0:1} = "3" ]] && [[ ! $RUBYOPT =~ "jit" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Lint first
|
# Lint first
|
||||||
if [[ ${RUBY_VERSION:0:3} = "3.1" ]] && [[ "$RUBY_ENGINE" = "ruby" ]]; then
|
if [[ ${RUBY_VERSION:0:3} = "3.2" ]] && [[ "$RUBY_ENGINE" = "ruby" ]]; then
|
||||||
bundle exec rake rubocop
|
bundle exec rake rubocop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user