mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-07-20 00:00:31 -04:00
Compare commits
7 Commits
c2416788db
...
f98b8d9c10
Author | SHA1 | Date | |
---|---|---|---|
|
f98b8d9c10 | ||
|
1e9fa3e38c | ||
|
efcadf7d2b | ||
|
71dee0c6e7 | ||
|
d0182eabab | ||
|
7fc8d70c53 | ||
|
e942b34a1f |
10
doc/release_notes/0_24_7.md
Normal file
10
doc/release_notes/0_24_7.md
Normal file
@ -0,0 +1,10 @@
|
||||
# 0.24.6
|
||||
|
||||
## dependencies
|
||||
|
||||
`http-2-next` last supported version for the 0.x series is the last version before v1. This shoul ensure that older versions of `httpx` won't be affected by any of the recent breaking changes.
|
||||
|
||||
## Bugfixes
|
||||
|
||||
* `grpc`: setup of rpc calls from camel-cased symbols has been fixed. As an improvement, the GRPC-enabled session will now support both snake-cased, as well as camel-cased calls.
|
||||
* `datadog` adapter has now been patched to support the most recent breaking changes of `ddtrace` configuration DSL (`env_to_bool` is no longer supported).
|
@ -32,5 +32,5 @@ Gem::Specification.new do |gem|
|
||||
|
||||
gem.require_paths = ["lib"]
|
||||
|
||||
gem.add_runtime_dependency "http-2-next", ">= 0.4.1"
|
||||
gem.add_runtime_dependency "http-2-next", "< 1.0.0"
|
||||
end
|
||||
|
@ -188,19 +188,39 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
|
||||
option :distributed_tracing, default: true
|
||||
option :split_by_domain, default: false
|
||||
|
||||
option :enabled do |o|
|
||||
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
|
||||
o.lazy
|
||||
end
|
||||
if DDTrace::VERSION::STRING >= "1.13.0"
|
||||
option :enabled do |o|
|
||||
o.type :bool
|
||||
o.env "DD_TRACE_HTTPX_ENABLED"
|
||||
o.default true
|
||||
end
|
||||
|
||||
option :analytics_enabled do |o|
|
||||
o.default { env_to_bool(%w[DD_TRACE_HTTPX_ANALYTICS_ENABLED DD_HTTPX_ANALYTICS_ENABLED], false) }
|
||||
o.lazy
|
||||
end
|
||||
option :analytics_enabled do |o|
|
||||
o.type :bool
|
||||
o.env "DD_TRACE_HTTPX_ANALYTICS_ENABLED"
|
||||
o.default false
|
||||
end
|
||||
|
||||
option :analytics_sample_rate do |o|
|
||||
o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
|
||||
o.lazy
|
||||
option :analytics_sample_rate do |o|
|
||||
o.type :float
|
||||
o.env "DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE"
|
||||
o.default 1.0
|
||||
end
|
||||
else
|
||||
option :enabled do |o|
|
||||
o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
|
||||
o.lazy
|
||||
end
|
||||
|
||||
option :analytics_enabled do |o|
|
||||
o.default { env_to_bool(%w[DD_TRACE_HTTPX_ANALYTICS_ENABLED DD_HTTPX_ANALYTICS_ENABLED], false) }
|
||||
o.lazy
|
||||
end
|
||||
|
||||
option :analytics_sample_rate do |o|
|
||||
o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
|
||||
o.lazy
|
||||
end
|
||||
end
|
||||
|
||||
if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
|
||||
@ -224,7 +244,19 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
|
||||
|
||||
option :distributed_tracing, default: true
|
||||
|
||||
option :error_handler, default: DEFAULT_ERROR_HANDLER
|
||||
if DDTrace::VERSION::STRING >= "1.15.0"
|
||||
option :error_handler do |o|
|
||||
o.type :proc
|
||||
o.default_proc(&DEFAULT_ERROR_HANDLER)
|
||||
end
|
||||
elsif DDTrace::VERSION::STRING >= "1.13.0"
|
||||
option :error_handler do |o|
|
||||
o.type :proc
|
||||
o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
|
||||
end
|
||||
else
|
||||
option :error_handler, default: DEFAULT_ERROR_HANDLER
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -141,17 +141,29 @@ module HTTPX
|
||||
deadline: @options.grpc_deadline,
|
||||
}.merge(opts)
|
||||
|
||||
local_rpc_name = rpc_name.underscore
|
||||
|
||||
session_class = Class.new(self.class) do
|
||||
# define rpc method with ruby style name
|
||||
class_eval(<<-OUT, __FILE__, __LINE__ + 1)
|
||||
def #{rpc_name}(input, **opts) # def grpc_action(input, **opts)
|
||||
rpc_execute("#{rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
|
||||
end # end
|
||||
def #{local_rpc_name}(input, **opts) # def grpc_action(input, **opts)
|
||||
rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
|
||||
end # end
|
||||
OUT
|
||||
|
||||
# define rpc method with original name
|
||||
unless local_rpc_name == rpc_name
|
||||
class_eval(<<-OUT, __FILE__, __LINE__ + 1)
|
||||
def #{rpc_name}(input, **opts) # def grpcAction(input, **opts)
|
||||
rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
|
||||
end # end
|
||||
OUT
|
||||
end
|
||||
end
|
||||
|
||||
session_class.new(@options.merge(
|
||||
grpc_rpcs: @options.grpc_rpcs.merge(
|
||||
rpc_name.underscore => [rpc_name, input, output, rpc_opts]
|
||||
local_rpc_name => [rpc_name, input, output, rpc_opts]
|
||||
).freeze
|
||||
))
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module HTTPX
|
||||
VERSION = "0.24.6"
|
||||
VERSION = "0.24.7"
|
||||
end
|
||||
|
@ -102,7 +102,7 @@ class HTTPXAwsSigv4Test < Minitest::Test
|
||||
private
|
||||
|
||||
def sigv4_session(**options)
|
||||
HTTPX.plugin(:aws_sigv4).aws_sigv4_authentication(**{ service: "s3", region: "us-east-1", username: "akid",
|
||||
password: "secret" }.merge(options))
|
||||
HTTPX.plugin(:aws_sigv4).aws_sigv4_authentication(service: "s3", region: "us-east-1", username: "akid",
|
||||
password: "secret", **options)
|
||||
end
|
||||
end
|
||||
|
@ -5,6 +5,18 @@ module Requests
|
||||
module GRPC
|
||||
include GRPCHelpers
|
||||
|
||||
def test_plugin_grpc_stub_rpc_defines_snake_case_methods
|
||||
server_port = run_rpc(TestService)
|
||||
grpc = grpc_plugin
|
||||
|
||||
# build service
|
||||
stub = grpc.build_stub("localhost:#{server_port}")
|
||||
|
||||
sv = stub.rpc(:aCamelCaseRpc, EchoMsg, EchoMsg, marshal_method: :marshal, unmarshal_method: :unmarshal)
|
||||
assert sv.respond_to? :a_camel_case_rpc
|
||||
assert sv.respond_to? :aCamelCaseRpc
|
||||
end
|
||||
|
||||
def test_plugin_grpc_unary_plain_bytestreams
|
||||
no_marshal = proc { |x| x }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user