async-http-faraday 0.12.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/examples/topics.rb +1 -1
- data/lib/async/http/faraday/adapter.rb +28 -2
- data/lib/async/http/faraday/default.rb +1 -1
- data/lib/async/http/faraday/version.rb +2 -2
- data/lib/async/http/faraday.rb +1 -1
- data/license.md +1 -1
- data/readme.md +13 -27
- data.tar.gz.sig +0 -0
- metadata +5 -61
- metadata.gz.sig +2 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab350ea82e4b97a4a08fa814825287e4ce92d327ce936d76fb15285b8eab39b3
|
4
|
+
data.tar.gz: '0651593c2937bddd8ebece312db4d4688111bc7029f61c71da814bd5866e3a5d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bff7ca5a8e0c5305e6d9fb75975fad4e5db34cc45546d37f5fdd4390148e7a310795d1bfe87ba164fc5d6149c3bb1df45c7b364ed2111f833d2954ae7045a5b3
|
7
|
+
data.tar.gz: ad8f7440d7760644437cff607b08c614bd6f2bd0c8ae02f6fdbb8f12c8ff5b9b5641ffa5fca69b5417e3902b0a28badd7eead77d20658e5b5fceb395d97883c7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/examples/topics.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2018, by Andreas Garnaes.
|
6
6
|
# Copyright, 2019, by Denis Talakevich.
|
7
7
|
# Copyright, 2019-2020, by Igor Sidorov.
|
@@ -18,6 +18,23 @@ require 'async/http/proxy'
|
|
18
18
|
module Async
|
19
19
|
module HTTP
|
20
20
|
module Faraday
|
21
|
+
class BodyReadWrapper < ::Protocol::HTTP::Body::Readable
|
22
|
+
def initialize(body, block_size: 4096)
|
23
|
+
@body = body
|
24
|
+
@block_size = block_size
|
25
|
+
end
|
26
|
+
|
27
|
+
def close(error = nil)
|
28
|
+
@body.close if @body.respond_to?(:close)
|
29
|
+
ensure
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def read
|
34
|
+
@body.read(@block_size)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
21
38
|
class Adapter < ::Faraday::Adapter
|
22
39
|
CONNECTION_EXCEPTIONS = [
|
23
40
|
Errno::EADDRNOTAVAIL,
|
@@ -85,6 +102,9 @@ module Async
|
|
85
102
|
def call(env)
|
86
103
|
super
|
87
104
|
|
105
|
+
# for compatibility with the default adapter
|
106
|
+
env.url.path = '/' if env.url.path.empty?
|
107
|
+
|
88
108
|
Sync do
|
89
109
|
endpoint = Endpoint.new(env.url)
|
90
110
|
|
@@ -96,7 +116,13 @@ module Async
|
|
96
116
|
end
|
97
117
|
|
98
118
|
if body = env.body
|
99
|
-
|
119
|
+
# We need to wrap the body in a Readable object so that it can be read in chunks:
|
120
|
+
# Faraday's body only responds to `#read`.
|
121
|
+
if body.respond_to?(:read)
|
122
|
+
body = BodyReadWrapper.new(body)
|
123
|
+
else
|
124
|
+
body = ::Protocol::HTTP::Body::Buffered.wrap(body)
|
125
|
+
end
|
100
126
|
end
|
101
127
|
|
102
128
|
if headers = env.request_headers
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
module Async
|
7
7
|
module HTTP
|
8
8
|
module Faraday
|
9
|
-
VERSION = "0.
|
9
|
+
VERSION = "0.13.1"
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/lib/async/http/faraday.rb
CHANGED
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -31,8 +31,8 @@ require 'async/http/faraday'
|
|
31
31
|
Faraday.default_adapter = :async_http
|
32
32
|
|
33
33
|
# Per connection:
|
34
|
-
|
35
|
-
|
34
|
+
connection = Faraday.new(...) do |builder|
|
35
|
+
builder.adapter :async_http
|
36
36
|
end
|
37
37
|
```
|
38
38
|
|
@@ -40,7 +40,7 @@ Here is how you make a request:
|
|
40
40
|
|
41
41
|
``` ruby
|
42
42
|
Async do
|
43
|
-
response =
|
43
|
+
response = connection.get("/index")
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
@@ -54,32 +54,18 @@ require 'async/http/faraday/default'
|
|
54
54
|
|
55
55
|
## Contributing
|
56
56
|
|
57
|
-
|
58
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
59
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
60
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
61
|
-
5. Create new Pull Request
|
57
|
+
We welcome contributions to this project.
|
62
58
|
|
63
|
-
|
59
|
+
1. Fork it.
|
60
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
61
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
62
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
63
|
+
5. Create new Pull Request.
|
64
64
|
|
65
|
-
|
65
|
+
### Developer Certificate of Origin
|
66
66
|
|
67
|
-
|
67
|
+
This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
|
68
68
|
|
69
|
-
|
70
|
-
of this software and associated documentation files (the "Software"), to deal
|
71
|
-
in the Software without restriction, including without limitation the rights
|
72
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
73
|
-
copies of the Software, and to permit persons to whom the Software is
|
74
|
-
furnished to do so, subject to the following conditions:
|
69
|
+
### Contributor Covenant
|
75
70
|
|
76
|
-
|
77
|
-
all copies or substantial portions of the Software.
|
78
|
-
|
79
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
80
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
81
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
82
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
83
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
84
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
85
|
-
THE SOFTWARE.
|
71
|
+
This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http-faraday
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
- Igor Sidorov
|
9
9
|
- Andreas Garnaes
|
10
|
+
- Genki Takiuchi
|
10
11
|
- Olle Jonsson
|
11
12
|
- Benoit Daloze
|
12
13
|
- Denis Talakevich
|
13
14
|
- Flavio Fernandes
|
14
|
-
- Genki Takiuchi
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain:
|
@@ -44,7 +44,7 @@ cert_chain:
|
|
44
44
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
45
45
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
46
46
|
-----END CERTIFICATE-----
|
47
|
-
date:
|
47
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
48
48
|
dependencies:
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: async-http
|
@@ -74,62 +74,6 @@ dependencies:
|
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
name: async-rspec
|
79
|
-
requirement: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '1.2'
|
84
|
-
type: :development
|
85
|
-
prerelease: false
|
86
|
-
version_requirements: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - "~>"
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '1.2'
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: bundler
|
93
|
-
requirement: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
type: :development
|
99
|
-
prerelease: false
|
100
|
-
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
- !ruby/object:Gem::Dependency
|
106
|
-
name: covered
|
107
|
-
requirement: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
type: :development
|
113
|
-
prerelease: false
|
114
|
-
version_requirements: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
- !ruby/object:Gem::Dependency
|
120
|
-
name: rspec
|
121
|
-
requirement: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - "~>"
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '3.6'
|
126
|
-
type: :development
|
127
|
-
prerelease: false
|
128
|
-
version_requirements: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - "~>"
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '3.6'
|
133
77
|
description:
|
134
78
|
email:
|
135
79
|
executables: []
|
@@ -156,14 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
100
|
requirements:
|
157
101
|
- - ">="
|
158
102
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
103
|
+
version: '3.0'
|
160
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
105
|
requirements:
|
162
106
|
- - ">="
|
163
107
|
- !ruby/object:Gem::Version
|
164
108
|
version: '0'
|
165
109
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
110
|
+
rubygems_version: 3.5.5
|
167
111
|
signing_key:
|
168
112
|
specification_version: 4
|
169
113
|
summary: Provides an adaptor between async-http and faraday.
|
metadata.gz.sig
CHANGED
@@ -1,5 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
_z-�·�5Y:�J^k�p�K�Z�fL���{��&j��=7��)'>��v'���%��Fc|�,es�u���rşVyw��EO���P:)�1��-�}��1�Ξ�Q�$�
|
4
|
-
A��"��`C��܁HZ �*ƊW�� E��RY
|
5
|
-
�H���zz�g��N�1�4���
|
1
|
+
�_t�p��Ӄ����K|6[G?�i9��)������[����bi�����1�k�awQܘ���q6�i|���� m�`oU�xi{�a��=�a�}��ZRPY�H�,o3^[���
|
2
|
+
O��~�k�u�Ҕ�Q�6U¾ٸ���m���i�né"�bP,�"|�aO������g@�m�1��lY!�'Gڱ[ة</[9q}�����j��XP�G�BӸc�&��zđ���G?����p�"���ͧ$�K�KX�{hVژ�O݄��:���]���Ϛ����OLSu��z0�mf!�9��Qq��^%�O��ʏ��R�_f���I:-`�Ɲ9��c~�d�a�蠳�~�-5ڛG�����������h�~T("N\�Ć�
|