mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-07-18 00:00:50 -04:00
Compare commits
No commits in common. "325f7141c846f95b2d4ee773d5a91cdf76b10abf" and "6f5e1fe5056bab352a4312e2d546a06aaf5c09e0" have entirely different histories.
325f7141c8
...
6f5e1fe505
4
Rakefile
4
Rakefile
@ -50,11 +50,11 @@ rdoc_opts = ["--line-numbers", "--title", "HTTPX: An HTTP client library for rub
|
||||
|
||||
begin
|
||||
gem "hanna-nouveau"
|
||||
rdoc_opts.push("-f", "hanna")
|
||||
rdoc_opts.concat(["-f", "hanna"])
|
||||
rescue Gem::LoadError
|
||||
end
|
||||
|
||||
rdoc_opts.push("--main", "README.md")
|
||||
rdoc_opts.concat(["--main", "README.md"])
|
||||
RDOC_FILES = %w[README.md lib/**/*.rb] + Dir["doc/*.rdoc"] + Dir["doc/release_notes/*.md"]
|
||||
|
||||
RDoc::Task.new do |rdoc|
|
||||
|
@ -197,21 +197,14 @@ class DatadogTest < Minitest::Test
|
||||
assert span.get_tag("out.port") == "80"
|
||||
assert span.get_tag("http.method") == verb
|
||||
assert span.get_tag("http.url") == uri.path
|
||||
|
||||
error_tag = if defined?(::DDTrace) && ::DDTrace::VERSION::STRING >= "1.8.0"
|
||||
"error.message"
|
||||
else
|
||||
"error.msg"
|
||||
end
|
||||
|
||||
if error
|
||||
assert span.get_tag("error.type") == error
|
||||
assert !span.get_tag(error_tag).nil?
|
||||
assert !span.get_tag("error.msg").nil?
|
||||
assert span.status == 1
|
||||
elsif response.status >= 400
|
||||
assert span.get_tag("http.status_code") == response.status.to_s
|
||||
assert span.get_tag("error.type") == "HTTPX::HTTPError"
|
||||
assert !span.get_tag(error_tag).nil?
|
||||
assert !span.get_tag("error.msg").nil?
|
||||
assert span.status == 1
|
||||
else
|
||||
assert span.status.zero?
|
||||
|
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
if defined?(DDTrace) && DDTrace::VERSION::STRING >= "1.0.0"
|
||||
if defined?(::DDTrace) && ::DDTrace::VERSION::STRING >= "1.0.0"
|
||||
require "datadog/tracing/contrib/integration"
|
||||
require "datadog/tracing/contrib/configuration/settings"
|
||||
require "datadog/tracing/contrib/patcher"
|
||||
|
@ -95,7 +95,7 @@ module HTTPX::Plugins
|
||||
end
|
||||
|
||||
Sentry.register_patch do
|
||||
sentry_session = HTTPX.plugin(HTTPX::Plugins::Sentry)
|
||||
sentry_session = ::HTTPX.plugin(HTTPX::Plugins::Sentry)
|
||||
|
||||
HTTPX.send(:remove_const, :Session)
|
||||
HTTPX.send(:const_set, :Session, sentry_session.class)
|
||||
|
@ -55,7 +55,6 @@ module HTTPX
|
||||
end
|
||||
|
||||
module NumericExtensions
|
||||
# Ruby 2.4 backport
|
||||
refine Numeric do
|
||||
def infinite?
|
||||
self == Float::INFINITY
|
||||
@ -65,7 +64,6 @@ module HTTPX
|
||||
|
||||
module StringExtensions
|
||||
refine String do
|
||||
# Ruby 2.5 backport
|
||||
def delete_suffix!(suffix)
|
||||
suffix = Backports.coerce_to_str(suffix)
|
||||
chomp! if frozen?
|
||||
@ -82,7 +80,6 @@ module HTTPX
|
||||
|
||||
module HashExtensions
|
||||
refine Hash do
|
||||
# Ruby 2.4 backport
|
||||
def compact
|
||||
h = {}
|
||||
each do |key, value|
|
||||
@ -96,7 +93,7 @@ module HTTPX
|
||||
module ArrayExtensions
|
||||
module FilterMap
|
||||
refine Array do
|
||||
# Ruby 2.7 backport
|
||||
|
||||
def filter_map
|
||||
return to_enum(:filter_map) unless block_given?
|
||||
|
||||
@ -110,7 +107,6 @@ module HTTPX
|
||||
|
||||
module Sum
|
||||
refine Array do
|
||||
# Ruby 2.6 backport
|
||||
def sum(accumulator = 0, &block)
|
||||
values = block_given? ? map(&block) : self
|
||||
values.inject(accumulator, :+)
|
||||
@ -120,7 +116,6 @@ module HTTPX
|
||||
|
||||
module Intersect
|
||||
refine Array do
|
||||
# Ruby 3.1 backport
|
||||
def intersect?(arr)
|
||||
if size < arr.size
|
||||
smaller = self
|
||||
@ -135,7 +130,6 @@ module HTTPX
|
||||
|
||||
module IOExtensions
|
||||
refine IO do
|
||||
# Ruby 2.3 backport
|
||||
# provides a fallback for rubies where IO#wait isn't implemented,
|
||||
# but IO#wait_readable and IO#wait_writable are.
|
||||
def wait(timeout = nil, _mode = :read_write)
|
||||
@ -150,7 +144,6 @@ module HTTPX
|
||||
|
||||
module RegexpExtensions
|
||||
refine(Regexp) do
|
||||
# Ruby 2.4 backport
|
||||
def match?(*args)
|
||||
!match(*args).nil?
|
||||
end
|
||||
@ -158,7 +151,6 @@ module HTTPX
|
||||
end
|
||||
|
||||
module URIExtensions
|
||||
# uri 0.11 backport, ships with ruby 3.1
|
||||
refine URI::Generic do
|
||||
def non_ascii_hostname
|
||||
@non_ascii_hostname
|
||||
|
@ -128,8 +128,6 @@ module HTTPX
|
||||
end
|
||||
|
||||
class Body
|
||||
attr_reader :encoding
|
||||
|
||||
def initialize(response, options)
|
||||
@response = response
|
||||
@headers = response.headers
|
||||
|
@ -38,6 +38,7 @@ module HTTPX::Transcoder
|
||||
begin
|
||||
require "nokogiri"
|
||||
|
||||
# rubocop:disable Lint/DuplicateMethods
|
||||
def decode(response)
|
||||
content_type = response.content_type.mime_type
|
||||
|
||||
@ -50,6 +51,7 @@ module HTTPX::Transcoder
|
||||
raise HTTPX::Error, "\"nokogiri\" is required in order to decode XML"
|
||||
end
|
||||
end
|
||||
# rubocop:enable Lint/DuplicateMethods
|
||||
end
|
||||
register "xml", Xml
|
||||
end
|
||||
|
@ -48,14 +48,13 @@ module HTTPX
|
||||
include _ToS
|
||||
include _ToStr
|
||||
|
||||
attr_reader encoding: String
|
||||
|
||||
@response: Response
|
||||
@headers: Headers
|
||||
@options: Options
|
||||
@state: :idle | :memory | :buffer | :closed
|
||||
@threshold_size: Integer
|
||||
@window_size: Integer
|
||||
@encoding: String
|
||||
@length: Integer
|
||||
@buffer: StringIO | Tempfile | nil
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
Signal.trap("USR2") do
|
||||
warn "starting..."
|
||||
Thread.list.each do |thread|
|
||||
warn "Thread TID-#{(thread.object_id ^ Process.pid).to_s(36)} #{thread.name}"
|
||||
warn "Thread TID-#{(thread.object_id ^ ::Process.pid).to_s(36)} #{thread.name}"
|
||||
warn thread.backtrace || "<no backtrace available>"
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user