faraday-net_http 1.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/faraday/adapter/net_http.rb +18 -7
- data/lib/faraday/net_http/version.rb +1 -1
- data/lib/faraday/net_http.rb +2 -2
- metadata +6 -132
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ef9f1370ac9c7ce8698f1101dd8bc2abe3127a3499c346af6b59bd46f0091f0
|
4
|
+
data.tar.gz: 012e6c8f79e2bb6a8ae7f22878d01ee7a5565f7eb5450bff25f7a49ea04760d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d386a528dc585efe0bc2cc539009bb8d5a39188632db3fac071115d7da70fa39b52e5fe259cb9d1e028c7ed07bd841098f1f82ec16a07c0a3cc5bb7275efb50
|
7
|
+
data.tar.gz: c2676a71f09277c68c62c2224609c07853062c353ac47f865d58d00d675cd52694730f660f4d0fb915fb4d20d06e6eca5f05749c7c2ce98e59fb21b691a54afb
|
data/README.md
CHANGED
@@ -20,16 +20,17 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
Configure your Faraday connection to use this adapter like this:
|
24
|
-
|
25
23
|
```ruby
|
26
|
-
|
27
|
-
|
24
|
+
conn = Faraday.new(...) do |f|
|
25
|
+
f.adapter :net_http do |http|
|
26
|
+
# yields Net::HTTP
|
27
|
+
http.verify_callback = lambda do |preverify, cert_store|
|
28
|
+
# do something here...
|
29
|
+
end
|
30
|
+
end
|
28
31
|
end
|
29
32
|
```
|
30
33
|
|
31
|
-
For more information on how to setup your Faraday connection and adapters usage, please refer to the [Faraday Website][faraday-website].
|
32
|
-
|
33
34
|
## Development
|
34
35
|
|
35
36
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -49,9 +50,8 @@ The gem is available as open source under the terms of the [license][license].
|
|
49
50
|
Everyone interacting in the Faraday Net::HTTP adapter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct][code-of-conduct].
|
50
51
|
|
51
52
|
[faraday]: https://github.com/lostisland/faraday
|
52
|
-
[faraday-website]: https://lostisland.github.io/faraday
|
53
53
|
[net-http]: https://ruby-doc.org/stdlib-2.7.0/libdoc/net/http/rdoc/Net/HTTP.html
|
54
54
|
[rubygems]: https://rubygems.org
|
55
55
|
[repo]: https://github.com/lostisland/faraday-net_http
|
56
56
|
[license]: https://github.com/lostisland/faraday-net_http/blob/main/LICENSE.md
|
57
|
-
[code-of-conduct]: https://github.com/lostisland/faraday-net_http/blob/main/CODE_OF_CONDUCT.md
|
57
|
+
[code-of-conduct]: https://github.com/lostisland/faraday-net_http/blob/main/CODE_OF_CONDUCT.md
|
@@ -15,6 +15,7 @@ module Faraday
|
|
15
15
|
exceptions = [
|
16
16
|
IOError,
|
17
17
|
Errno::EADDRNOTAVAIL,
|
18
|
+
Errno::EALREADY,
|
18
19
|
Errno::ECONNABORTED,
|
19
20
|
Errno::ECONNREFUSED,
|
20
21
|
Errno::ECONNRESET,
|
@@ -62,17 +63,15 @@ module Faraday
|
|
62
63
|
def call(env)
|
63
64
|
super
|
64
65
|
http_response = connection(env) do |http|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
raise Faraday::SSLError, e if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
|
66
|
+
perform_request(http, env)
|
67
|
+
rescue *NET_HTTP_EXCEPTIONS => e
|
68
|
+
raise Faraday::SSLError, e if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
|
69
69
|
|
70
|
-
|
71
|
-
end
|
70
|
+
raise Faraday::ConnectionFailed, e
|
72
71
|
end
|
73
72
|
|
74
73
|
save_response(env, http_response.code.to_i,
|
75
|
-
http_response
|
74
|
+
encoded_body(http_response), nil,
|
76
75
|
http_response.message) do |response_headers|
|
77
76
|
http_response.each_header do |key, value|
|
78
77
|
response_headers[key] = value
|
@@ -208,6 +207,18 @@ module Faraday
|
|
208
207
|
end
|
209
208
|
end
|
210
209
|
end
|
210
|
+
|
211
|
+
def encoded_body(http_response)
|
212
|
+
body = http_response.body || +''
|
213
|
+
/\bcharset=\s*(.+?)\s*(;|$)/.match(http_response['Content-Type']) do |match|
|
214
|
+
content_charset = ::Encoding.find(match.captures.first)
|
215
|
+
body = body.dup if body.frozen?
|
216
|
+
body.force_encoding(content_charset)
|
217
|
+
rescue ArgumentError
|
218
|
+
nil
|
219
|
+
end
|
220
|
+
body
|
221
|
+
end
|
211
222
|
end
|
212
223
|
end
|
213
224
|
end
|
data/lib/faraday/net_http.rb
CHANGED
metadata
CHANGED
@@ -1,153 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-net_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan van der Pas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '13.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '13.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: simplecov
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.19.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.19.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: multipart-parser
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.1.1
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.1.1
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: webmock
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '3.4'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '3.4'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.91.1
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.91.1
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-packaging
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0.5'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0.5'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rubocop-performance
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '1.0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
24
|
+
- - ">="
|
151
25
|
- !ruby/object:Gem::Version
|
152
26
|
version: '1.0'
|
153
27
|
description: Faraday adapter for Net::HTTP
|
@@ -168,7 +42,7 @@ licenses:
|
|
168
42
|
metadata:
|
169
43
|
homepage_uri: https://github.com/lostisland/faraday-net_http
|
170
44
|
source_code_uri: https://github.com/lostisland/faraday-net_http
|
171
|
-
changelog_uri: https://github.com/lostisland/faraday-net_http
|
45
|
+
changelog_uri: https://github.com/lostisland/faraday-net_http/releases/tag/v2.0.3
|
172
46
|
post_install_message:
|
173
47
|
rdoc_options: []
|
174
48
|
require_paths:
|
@@ -184,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
58
|
- !ruby/object:Gem::Version
|
185
59
|
version: '0'
|
186
60
|
requirements: []
|
187
|
-
rubygems_version: 3.1.
|
61
|
+
rubygems_version: 3.1.6
|
188
62
|
signing_key:
|
189
63
|
specification_version: 4
|
190
64
|
summary: Faraday adapter for Net::HTTP
|