async-http-faraday 0.12.0 → 0.14.0
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 +8 -63
- metadata.gz.sig +0 -0
- data/lib/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8efd253e7a697bce2dbe8aafcab6cc667584242e923ee060213ee88ba40a2ce
|
4
|
+
data.tar.gz: 34c1d934c5e153091a04e5208144026d5da10e6dd429c67a0770a3f25b71ecdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d921cee566700dc9c82bbf9f993f20c8f912523ed75b78d7f644c0e962fce63203f38648867ebc74b600713d1240db7909d69f0199ac56e3dcef90942ac855e
|
7
|
+
data.tar.gz: 8a7746559ec23c868445ae1d18201d6ac00c38ef1c950d0401d14cf62c4852c4861ad852d5bc9fe7044840b7db659ff63ef7088354fded353014f1641d04bdad
|
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.14.0"
|
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.14.0
|
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-04-23 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: []
|
@@ -137,7 +81,6 @@ extensions: []
|
|
137
81
|
extra_rdoc_files: []
|
138
82
|
files:
|
139
83
|
- examples/topics.rb
|
140
|
-
- lib/.DS_Store
|
141
84
|
- lib/async/http/faraday.rb
|
142
85
|
- lib/async/http/faraday/adapter.rb
|
143
86
|
- lib/async/http/faraday/default.rb
|
@@ -147,7 +90,9 @@ files:
|
|
147
90
|
homepage: https://github.com/socketry/async-http
|
148
91
|
licenses:
|
149
92
|
- MIT
|
150
|
-
metadata:
|
93
|
+
metadata:
|
94
|
+
documentation_uri: https://socketry.github.io/async-http/
|
95
|
+
source_code_uri: https://github.com/socketry/async-http.git
|
151
96
|
post_install_message:
|
152
97
|
rdoc_options: []
|
153
98
|
require_paths:
|
@@ -156,14 +101,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
101
|
requirements:
|
157
102
|
- - ">="
|
158
103
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
104
|
+
version: '3.1'
|
160
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
106
|
requirements:
|
162
107
|
- - ">="
|
163
108
|
- !ruby/object:Gem::Version
|
164
109
|
version: '0'
|
165
110
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
111
|
+
rubygems_version: 3.5.3
|
167
112
|
signing_key:
|
168
113
|
specification_version: 4
|
169
114
|
summary: Provides an adaptor between async-http and faraday.
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/.DS_Store
DELETED
Binary file
|