async-http-faraday 0.11.0 → 0.12.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: 461ee3d89afc1d0c8077b02f2bddfa4e9fd91e311fa810cb005aea26c0135b57
4
- data.tar.gz: fc58f167759eaeadfe849ea631986a2f112bc959ec72ea2b7b9703b5126baf8c
3
+ metadata.gz: bb8d8e1aa9d79153243004581a6e6c7c68591a87856944f99ab383787b873999
4
+ data.tar.gz: 975a58648df70b91f5d2c8bb3073bc1bb6f86ecebdf155a2c87132d7dacace18
5
5
  SHA512:
6
- metadata.gz: 421f27bf1a380003fee2c76ba501a74984e01abc7a380bb5bd8f75452bbf2fa5cc3d25a135bd47813e8248ecff92d625f285e078e04c335c4df21831726fe324
7
- data.tar.gz: 30993cd6afe2bd13f20178d8ca1b1560a47a20cc68f2e4bfbb456a4f59b5c55590d8a1319db0210abdca3c3dabc1a703867ac550d0f801efec3c7c3397039c07
6
+ metadata.gz: ec5ffb04ddb5457593b11d188aacf7572b32dcf40d6c355f8e5f62103d576af91461409355a745d948f5ac0973b52b0782d64f61eef173f116315083a37eee82
7
+ data.tar.gz: 2ddd238bfaf76167a2c95b233482c909fee7f280170d93b87569ab8c284d2c61e211e4d2c2eb6fad35a682af6d9428ae432a1aa6713a6250c5f09d0ea98af8db
checksums.yaml.gz.sig ADDED
Binary file
data/examples/topics.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Released under the MIT License.
5
+ # Copyright, 2020, by Samuel Williams.
6
+
4
7
  $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
5
8
 
6
9
  require 'async'
data/lib/.DS_Store CHANGED
Binary file
@@ -1,24 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2021, by Samuel Williams.
5
+ # Copyright, 2018, by Andreas Garnaes.
6
+ # Copyright, 2019, by Denis Talakevich.
7
+ # Copyright, 2019-2020, by Igor Sidorov.
8
+ # Copyright, 2023, by Genki Takiuchi.
9
+ # Copyright, 2023, by Flavio Fernandes.
22
10
 
23
11
  require 'faraday'
24
12
  require 'faraday/adapter'
@@ -27,8 +15,6 @@ require 'kernel/sync'
27
15
  require 'async/http/client'
28
16
  require 'async/http/proxy'
29
17
 
30
- require_relative 'agent'
31
-
32
18
  module Async
33
19
  module HTTP
34
20
  module Faraday
@@ -117,14 +103,14 @@ module Async
117
103
  headers = ::Protocol::HTTP::Headers[headers]
118
104
  end
119
105
 
120
- method = env.method.upcase
106
+ method = env.method.to_s.upcase
121
107
 
122
108
  request = ::Protocol::HTTP::Request.new(endpoint.scheme, endpoint.authority, method, endpoint.path, nil, headers, body)
123
109
 
124
110
  with_timeout do
125
111
  response = client.call(request)
126
112
 
127
- save_response(env, response.status, response.read, response.headers)
113
+ save_response(env, response.status, encoded_body(response), response.headers)
128
114
  end
129
115
  end
130
116
 
@@ -148,6 +134,32 @@ module Async
148
134
  yield
149
135
  end
150
136
  end
137
+
138
+ def encoded_body(response)
139
+ body = response.read
140
+ return body if body.nil?
141
+ content_type = response.headers['content-type']
142
+ return body unless content_type
143
+ params = extract_type_parameters(content_type)
144
+ if charset = params['charset']
145
+ body = body.dup if body.frozen?
146
+ body.force_encoding(charset)
147
+ end
148
+ body
149
+ rescue ArgumentError
150
+ nil
151
+ end
152
+
153
+ def extract_type_parameters(content_type)
154
+ result = {}
155
+ list = content_type.split(';')
156
+ list.shift
157
+ list.each do |param|
158
+ key, value = *param.split('=', 2)
159
+ result[key.strip] = value.strip
160
+ end
161
+ result
162
+ end
151
163
  end
152
164
  end
153
165
  end
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020, by Samuel Williams.
22
5
 
23
6
  require_relative 'adapter'
24
7
 
@@ -1,29 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2021, by Samuel Williams.
22
5
 
23
6
  module Async
24
7
  module HTTP
25
8
  module Faraday
26
- VERSION = "0.11.0"
9
+ VERSION = "0.12.0"
27
10
  end
28
11
  end
29
12
  end
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2020, by Samuel Williams.
22
5
 
23
6
  require_relative "faraday/version"
24
7
  require_relative "faraday/adapter"
data/license.md ADDED
@@ -0,0 +1,28 @@
1
+ # MIT License
2
+
3
+ Copyright, 2018-2021, by Samuel Williams.
4
+ Copyright, 2018, by Andreas Garnaes.
5
+ Copyright, 2019, by Denis Talakevich.
6
+ Copyright, 2019-2020, by Igor Sidorov.
7
+ Copyright, 2020-2021, by Olle Jonsson.
8
+ Copyright, 2020, by Benoit Daloze.
9
+ Copyright, 2023, by Genki Takiuchi.
10
+ Copyright, 2023, by Flavio Fernandes.
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,85 @@
1
+ # Async::HTTP::Faraday
2
+
3
+ Provides an adaptor for [Faraday](https://github.com/lostisland/faraday) to perform async HTTP requests. If you are designing a new library, you should probably just use `Async::HTTP::Client` directly.
4
+
5
+ [![Development Status](https://github.com/socketry/async-http-faraday/workflows/Test/badge.svg)](https://github.com/socketry/async-http-faraday/actions?workflow=Test)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ``` ruby
12
+ gem 'async-http-faraday'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install async-http-faraday
22
+
23
+ ## Usage
24
+
25
+ Here is how you set faraday to use `Async::HTTP`:
26
+
27
+ ``` ruby
28
+ require 'async/http/faraday'
29
+
30
+ # Make it the global default:
31
+ Faraday.default_adapter = :async_http
32
+
33
+ # Per connection:
34
+ conn = Faraday.new(...) do |faraday|
35
+ faraday.adapter :async_http
36
+ end
37
+ ```
38
+
39
+ Here is how you make a request:
40
+
41
+ ``` ruby
42
+ Async do
43
+ response = conn.get("/index")
44
+ end
45
+ ```
46
+
47
+ ### Default
48
+
49
+ To make this the default adaptor:
50
+
51
+ ``` ruby
52
+ require 'async/http/faraday/default'
53
+ ```
54
+
55
+ ## Contributing
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.
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,50 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http-faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - Igor Sidorov
9
+ - Andreas Garnaes
10
+ - Olle Jonsson
11
+ - Benoit Daloze
12
+ - Denis Talakevich
13
+ - Flavio Fernandes
14
+ - Genki Takiuchi
8
15
  autorequire:
9
16
  bindir: bin
10
- cert_chain: []
11
- date: 2021-06-17 00:00:00.000000000 Z
17
+ cert_chain:
18
+ - |
19
+ -----BEGIN CERTIFICATE-----
20
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
21
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
22
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
23
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
24
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
25
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
26
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
27
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
28
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
29
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
30
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
31
+ RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
32
+ tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
33
+ zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
34
+ xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
35
+ BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
36
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
37
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
38
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
39
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
40
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
41
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
42
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
43
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
44
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
45
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
46
+ -----END CERTIFICATE-----
47
+ date: 2023-04-25 00:00:00.000000000 Z
12
48
  dependencies:
13
49
  - !ruby/object:Gem::Dependency
14
50
  name: async-http
@@ -104,9 +140,10 @@ files:
104
140
  - lib/.DS_Store
105
141
  - lib/async/http/faraday.rb
106
142
  - lib/async/http/faraday/adapter.rb
107
- - lib/async/http/faraday/agent.rb
108
143
  - lib/async/http/faraday/default.rb
109
144
  - lib/async/http/faraday/version.rb
145
+ - license.md
146
+ - readme.md
110
147
  homepage: https://github.com/socketry/async-http
111
148
  licenses:
112
149
  - MIT
@@ -126,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
163
  - !ruby/object:Gem::Version
127
164
  version: '0'
128
165
  requirements: []
129
- rubygems_version: 3.2.15
166
+ rubygems_version: 3.4.10
130
167
  signing_key:
131
168
  specification_version: 4
132
169
  summary: Provides an adaptor between async-http and faraday.
metadata.gz.sig ADDED
@@ -0,0 +1,5 @@
1
+ R�����W��Sa���K��@2� 4*�Rۂ��魴l�~���lO|��F쿊� s�'U�Xh�|uQ��_F��P��#��e��R`�w��u�'M��a�� �mʯ�b:uH��}���� sa����H^
2
+ ؗY��\Iq�Y:<X��� �Ɣ���w�2���8
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,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- begin
24
- require 'sawyer/agent'
25
-
26
- # This is a nasty hack until https://github.com/lostisland/sawyer/pull/67 is resolved:
27
- unless Sawyer::Agent.instance_methods.include?(:close)
28
- class Sawyer::Agent
29
- def close
30
- @conn.close if @conn.respond_to?(:close)
31
- end
32
- end
33
- end
34
- rescue LoadError
35
- # Ignore.
36
- end