async-http-faraday 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb8d8e1aa9d79153243004581a6e6c7c68591a87856944f99ab383787b873999
4
- data.tar.gz: 975a58648df70b91f5d2c8bb3073bc1bb6f86ecebdf155a2c87132d7dacace18
3
+ metadata.gz: f29979ba18e04a42d3d6e1f3f9c526ad317855469b29c0a558f5a44a9fc71ad9
4
+ data.tar.gz: 6f2fdb360239562744b4cfda02b149d02320db6f739b9295c9e255741b33b921
5
5
  SHA512:
6
- metadata.gz: ec5ffb04ddb5457593b11d188aacf7572b32dcf40d6c355f8e5f62103d576af91461409355a745d948f5ac0973b52b0782d64f61eef173f116315083a37eee82
7
- data.tar.gz: 2ddd238bfaf76167a2c95b233482c909fee7f280170d93b87569ab8c284d2c61e211e4d2c2eb6fad35a682af6d9428ae432a1aa6713a6250c5f09d0ea98af8db
6
+ metadata.gz: 52cf7f3d635dfe2aeb1dfba9d0368cc080378e5481db807ff55764563f74cb5cf42adb1745d9543c64871043e645282826e3940128bf6df7c00460d7a0ec6478
7
+ data.tar.gz: 9e24af568c3f181b3ac25076bac2d5285ac6ece909e095e9763207755244ffc068a80ec1705bc4ede81442dd3c7d232ae7f3a079c5f8ea9fb40d7aa6263c8f34
checksums.yaml.gz.sig CHANGED
Binary file
data/examples/topics.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  # Released under the MIT License.
5
- # Copyright, 2020, by Samuel Williams.
5
+ # Copyright, 2020-2024, by Samuel Williams.
6
6
 
7
7
  $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
8
8
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2021, by Samuel Williams.
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 BodyWrapper < ::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,10 @@ module Async
96
116
  end
97
117
 
98
118
  if body = env.body
99
- body = Body::Buffered.wrap(body)
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
+ # body = ::Protocol::HTTP::Body::Buffered.wrap(body)
122
+ body = BodyWrapper.new(body)
100
123
  end
101
124
 
102
125
  if headers = env.request_headers
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020, by Samuel Williams.
4
+ # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
6
  require_relative 'adapter'
7
7
 
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2021, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
6
  module Async
7
7
  module HTTP
8
8
  module Faraday
9
- VERSION = "0.12.0"
9
+ VERSION = "0.13.0"
10
10
  end
11
11
  end
12
12
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2020, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
6
  require_relative "faraday/version"
7
7
  require_relative "faraday/adapter"
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2018-2021, by Samuel Williams.
3
+ Copyright, 2018-2024, by Samuel Williams.
4
4
  Copyright, 2018, by Andreas Garnaes.
5
5
  Copyright, 2019, by Denis Talakevich.
6
6
  Copyright, 2019-2020, by Igor Sidorov.
data/readme.md CHANGED
@@ -54,32 +54,18 @@ require 'async/http/faraday/default'
54
54
 
55
55
  ## Contributing
56
56
 
57
- 1. Fork it
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
62
-
63
- ## License
64
-
65
- Released under the MIT license.
66
-
67
- Copyright, 2015, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
68
-
69
- Permission is hereby granted, free of charge, to any person obtaining a copy
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:
75
-
76
- The above copyright notice and this permission notice shall be included in
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.
57
+ We welcome contributions to this project.
58
+
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
+
65
+ ### Developer Certificate of Origin
66
+
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
+
69
+ ### Contributor Covenant
70
+
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.12.0
4
+ version: 0.13.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: 2023-04-25 00:00:00.000000000 Z
47
+ date: 2024-02-07 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
@@ -156,14 +99,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
99
  requirements:
157
100
  - - ">="
158
101
  - !ruby/object:Gem::Version
159
- version: '0'
102
+ version: '3.0'
160
103
  required_rubygems_version: !ruby/object:Gem::Requirement
161
104
  requirements:
162
105
  - - ">="
163
106
  - !ruby/object:Gem::Version
164
107
  version: '0'
165
108
  requirements: []
166
- rubygems_version: 3.4.10
109
+ rubygems_version: 3.5.3
167
110
  signing_key:
168
111
  specification_version: 4
169
112
  summary: Provides an adaptor between async-http and faraday.
metadata.gz.sig CHANGED
Binary file
data/lib/.DS_Store DELETED
Binary file