better-faraday 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/better-faraday.gemspec +1 -1
- data/lib/better-faraday.rb +12 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '029d062e2489930531b838ecc65cb796e42d788af3d500b9f5aa41652da5a618'
|
|
4
|
+
data.tar.gz: 13720228f3665ccff0f2138237460a24372a7a0c84677d6a8aeaf57bd4fa8cc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f2d6dc2b4b31f7aca5f809f314498054a9886e9170d772b5d9f179349332f81128424cf9856016a92b0fc6ff030f62915fd01609092190beb15806533a33879
|
|
7
|
+
data.tar.gz: d4bff4011ba625fae33ebf4222801df54419d958296b8cb59ff08ad6b30912e7e459b311ffc051131c944aee9713ea14e9209e7aff2f622d20bdbaee10f17c4d
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.7.
|
|
1
|
+
2.7.8
|
data/better-faraday.gemspec
CHANGED
data/lib/better-faraday.rb
CHANGED
|
@@ -7,10 +7,8 @@ require "faraday"
|
|
|
7
7
|
require "faraday/error"
|
|
8
8
|
require "faraday/options"
|
|
9
9
|
require "faraday/response"
|
|
10
|
-
require "active_support/core_ext/object/deep_dup"
|
|
11
10
|
require "active_support/core_ext/string/filters"
|
|
12
11
|
require "active_support/core_ext/string/inflections"
|
|
13
|
-
require "active_support/core_ext/object/inclusion"
|
|
14
12
|
|
|
15
13
|
Module.new do
|
|
16
14
|
def call(environment)
|
|
@@ -52,7 +50,10 @@ Module.new do
|
|
|
52
50
|
response.instance_variable_get(:@bf_request_headers)
|
|
53
51
|
end
|
|
54
52
|
end
|
|
55
|
-
end.tap
|
|
53
|
+
end.tap do |m|
|
|
54
|
+
Faraday::Adapter::NetHttp.prepend(m)
|
|
55
|
+
Faraday::Adapter::NetHttpPersistent.prepend(m) if defined?(Faraday::Adapter::NetHttpPersistent)
|
|
56
|
+
end
|
|
56
57
|
|
|
57
58
|
module Faraday
|
|
58
59
|
class Env
|
|
@@ -62,7 +63,7 @@ module Faraday
|
|
|
62
63
|
class Response
|
|
63
64
|
def assert_status!(code_or_range)
|
|
64
65
|
within_range = if Range === code_or_range
|
|
65
|
-
|
|
66
|
+
code_or_range.include?(status)
|
|
66
67
|
else
|
|
67
68
|
status == code_or_range
|
|
68
69
|
end
|
|
@@ -113,7 +114,9 @@ module Faraday
|
|
|
113
114
|
response_body_bytes_count = response_body.bytesize
|
|
114
115
|
|
|
115
116
|
if env.bf_request_headers["content-type"].to_s.match?(/\bapplication\/json\b/i)
|
|
116
|
-
request_json =
|
|
117
|
+
request_json = bf_json_parse(request_body).yield_self do |data|
|
|
118
|
+
bf_json_dump(bf_protect_data(data)) if data
|
|
119
|
+
end
|
|
117
120
|
end
|
|
118
121
|
|
|
119
122
|
if env.response_headers
|
|
@@ -121,7 +124,9 @@ module Faraday
|
|
|
121
124
|
end
|
|
122
125
|
|
|
123
126
|
if env.response_headers && env.response_headers["content-type"].to_s.match?(/\bapplication\/json\b/i)
|
|
124
|
-
response_json =
|
|
127
|
+
response_json = bf_json_parse(response_body).yield_self do |data|
|
|
128
|
+
bf_json_dump(bf_protect_data(data)) if data
|
|
129
|
+
end
|
|
125
130
|
end
|
|
126
131
|
|
|
127
132
|
lines = [
|
|
@@ -233,6 +238,7 @@ module BetterFaraday
|
|
|
233
238
|
class HTTP401 < HTTP4xx; end
|
|
234
239
|
class HTTP403 < HTTP4xx; end
|
|
235
240
|
class HTTP404 < HTTP4xx; end
|
|
241
|
+
class HTTP408 < HTTP4xx; end
|
|
236
242
|
class HTTP422 < HTTP4xx; end
|
|
237
243
|
class HTTP429 < HTTP4xx; end
|
|
238
244
|
class HTTP5xx < HTTPError; end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: better-faraday
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yaroslav Konoplov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-02-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|