httparty 0.17.1 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of httparty might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/.rubocop_todo.yml +1 -1
- data/Changelog.md +22 -1
- data/README.md +2 -0
- data/docs/README.md +1 -1
- data/lib/httparty.rb +5 -5
- data/lib/httparty/cookie_hash.rb +7 -7
- data/lib/httparty/hash_conversions.rb +1 -1
- data/lib/httparty/request.rb +5 -12
- data/lib/httparty/response.rb +14 -0
- data/lib/httparty/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 21274d1c09f3460352bc2aaf0cc00e6c0f9fb76eae45bc6dd0a65748c8d29463
|
4
|
+
data.tar.gz: c6900248181afef6fdf36381d4e33365345073a5a00f73498ac3e89259838f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 116978b76182751905d115a80ac0e350637564cad3c8d2bf8938ffcac99ff0e782bd810aa9889db3218ad147d38632c75fd85521682d22d7bb654de8cf1d0352
|
7
|
+
data.tar.gz: 2048e308a2d88288f9ab373f1472acd9955aeb7870c2a8cbfc128d0b71ace183bc7011a20f2f20ce7c2e37e400b4c9c6a3b695fc6dc36144e583a7151fc4a5e1
|
data/.rubocop_todo.yml
CHANGED
data/Changelog.md
CHANGED
@@ -1,8 +1,29 @@
|
|
1
|
+
## 0.18.1
|
2
|
+
|
3
|
+
* [Rename cop Lint/HandleExceptions to Lint/SuppressedException](https://github.com/jnunemaker/httparty/pull/699).
|
4
|
+
* [Encode keys in query params](https://github.com/jnunemaker/httparty/pull/698).
|
5
|
+
* [Fixed SSL doc example](https://github.com/jnunemaker/httparty/pull/692).
|
6
|
+
* [Add a build status badge](https://github.com/jnunemaker/httparty/pull/701).
|
7
|
+
|
8
|
+
|
9
|
+
## 0.18.0
|
10
|
+
|
11
|
+
* [Support gzip/deflate transfer encoding when explicit headers are set](https://github.com/jnunemaker/httparty/pull/678).
|
12
|
+
* [Support edge case cookie format with a blank attribute](https://github.com/jnunemaker/httparty/pull/685).
|
13
|
+
|
14
|
+
## 0.17.3
|
15
|
+
|
16
|
+
0.17.2 is broken https://github.com/jnunemaker/httparty/issues/681
|
17
|
+
|
18
|
+
## 0.17.2
|
19
|
+
|
20
|
+
* [Add Response#nil? deprecetion warning](https://github.com/jnunemaker/httparty/pull/680)
|
21
|
+
|
1
22
|
## 0.17.1
|
2
23
|
|
3
24
|
* [Pass options to dynamic block headers](https://github.com/jnunemaker/httparty/pull/661)
|
4
25
|
* [Normalize urls with URI adapter to allow International Domain Names support](https://github.com/jnunemaker/httparty/pull/668)
|
5
|
-
* [Add max_retries support](https://github.com/jnunemaker/httparty/pull/
|
26
|
+
* [Add max_retries support](https://github.com/jnunemaker/httparty/pull/660)
|
6
27
|
* [Minize gem size by removing test files](https://github.com/jnunemaker/httparty/pull/658)
|
7
28
|
|
8
29
|
## 0.17.0
|
data/README.md
CHANGED
data/docs/README.md
CHANGED
@@ -79,7 +79,7 @@ class Client
|
|
79
79
|
base_uri "https://example.com"
|
80
80
|
|
81
81
|
def self.fetch
|
82
|
-
get("/resources", pem:
|
82
|
+
get("/resources", pem: File.read("#{File.expand_path('.')}/path/to/certs/cert.pem"), pem_password: "123456")
|
83
83
|
end
|
84
84
|
end
|
85
85
|
```
|
data/lib/httparty.rb
CHANGED
@@ -41,11 +41,11 @@ module HTTParty
|
|
41
41
|
# [:+limit+:] Maximum number of redirects to follow. Takes precedences over :+no_follow+.
|
42
42
|
# [:+query+:] Query string, or an object that responds to #to_hash representing it. Normalized according to the same rules as :+body+. If you specify this on a POST, you must use an object which responds to #to_hash. See also HTTParty::ClassMethods.default_params.
|
43
43
|
# [:+timeout+:] Timeout for opening connection and reading data.
|
44
|
-
# [:+local_host
|
45
|
-
# [:+local_port
|
46
|
-
# [:+body_stream
|
47
|
-
# [:+stream_body
|
48
|
-
# [:+multipart
|
44
|
+
# [:+local_host+:] Local address to bind to before connecting.
|
45
|
+
# [:+local_port+:] Local port to bind to before connecting.
|
46
|
+
# [:+body_stream+:] Allow streaming to a REST server to specify a body_stream.
|
47
|
+
# [:+stream_body+:] Allow for streaming large files without loading them into memory.
|
48
|
+
# [:+multipart+:] Force content-type to be multipart
|
49
49
|
#
|
50
50
|
# There are also another set of options with names corresponding to various class methods. The methods in question are those that let you set a class-wide default, and the options override the defaults on a request-by-request basis. Those options are:
|
51
51
|
# * :+base_uri+: see HTTParty::ClassMethods.base_uri.
|
data/lib/httparty/cookie_hash.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
class HTTParty::CookieHash < Hash #:nodoc:
|
2
|
-
CLIENT_COOKIES = %w(path expires domain path secure httponly)
|
2
|
+
CLIENT_COOKIES = %w(path expires domain path secure httponly samesite)
|
3
3
|
|
4
|
-
def add_cookies(
|
5
|
-
case
|
4
|
+
def add_cookies(data)
|
5
|
+
case data
|
6
6
|
when Hash
|
7
|
-
merge!(
|
7
|
+
merge!(data)
|
8
8
|
when String
|
9
|
-
|
10
|
-
|
11
|
-
self[
|
9
|
+
data.split('; ').each do |cookie|
|
10
|
+
key, value = cookie.split('=', 2)
|
11
|
+
self[key.to_sym] = value if key
|
12
12
|
end
|
13
13
|
else
|
14
14
|
raise "add_cookies only takes a Hash or a String"
|
@@ -27,7 +27,7 @@ module HTTParty
|
|
27
27
|
normalized_keys = normalize_keys(key, value)
|
28
28
|
|
29
29
|
normalized_keys.flatten.each_slice(2).inject('') do |string, (k, v)|
|
30
|
-
string + "#{k}=#{ERB::Util.url_encode(v.to_s)}&"
|
30
|
+
string + "#{ERB::Util.url_encode(k)}=#{ERB::Util.url_encode(v.to_s)}&"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/lib/httparty/request.rb
CHANGED
@@ -204,22 +204,15 @@ module HTTParty
|
|
204
204
|
end
|
205
205
|
|
206
206
|
def setup_raw_request
|
207
|
-
@raw_request = http_method.new(request_uri(uri))
|
208
|
-
@raw_request.body_stream = options[:body_stream] if options[:body_stream]
|
209
|
-
|
210
207
|
if options[:headers].respond_to?(:to_hash)
|
211
208
|
headers_hash = options[:headers].to_hash
|
212
|
-
|
213
|
-
|
214
|
-
# If the caller specified a header of 'Accept-Encoding', assume they want to
|
215
|
-
# deal with encoding of content. Disable the internal logic in Net:HTTP
|
216
|
-
# that handles encoding, if the platform supports it.
|
217
|
-
if @raw_request.respond_to?(:decode_content) && (headers_hash.key?('Accept-Encoding') || headers_hash.key?('accept-encoding'))
|
218
|
-
# Using the '[]=' sets decode_content to false
|
219
|
-
@raw_request['accept-encoding'] = @raw_request['accept-encoding']
|
220
|
-
end
|
209
|
+
else
|
210
|
+
headers_hash = nil
|
221
211
|
end
|
222
212
|
|
213
|
+
@raw_request = http_method.new(request_uri(uri), headers_hash)
|
214
|
+
@raw_request.body_stream = options[:body_stream] if options[:body_stream]
|
215
|
+
|
223
216
|
if options[:body]
|
224
217
|
body = Body.new(
|
225
218
|
options[:body],
|
data/lib/httparty/response.rb
CHANGED
@@ -79,6 +79,7 @@ module HTTParty
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def nil?
|
82
|
+
warn_about_nil_deprecation
|
82
83
|
response.nil? || response.body.nil? || response.body.empty?
|
83
84
|
end
|
84
85
|
|
@@ -134,6 +135,19 @@ module HTTParty
|
|
134
135
|
::Kernel.raise ::HTTParty::ResponseError.new(@response), "Code #{code} - #{body}"
|
135
136
|
end
|
136
137
|
end
|
138
|
+
|
139
|
+
private
|
140
|
+
|
141
|
+
def warn_about_nil_deprecation
|
142
|
+
trace_line = caller.reject { |line| line.include?('httparty') }.first
|
143
|
+
warning = "[DEPRECATION] HTTParty will no longer override `response#nil?`. " \
|
144
|
+
"This functionality will be removed in future versions. " \
|
145
|
+
"Please, add explicit check `response.body.nil? || response.body.empty?`. " \
|
146
|
+
"For more info refer to: https://github.com/jnunemaker/httparty/issues/568\n" \
|
147
|
+
"#{trace_line}"
|
148
|
+
|
149
|
+
warn(warning)
|
150
|
+
end
|
137
151
|
end
|
138
152
|
end
|
139
153
|
|
data/lib/httparty/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_xml
|
@@ -129,8 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
|
-
|
133
|
-
rubygems_version: 2.6.14
|
132
|
+
rubygems_version: 3.1.2
|
134
133
|
signing_key:
|
135
134
|
specification_version: 4
|
136
135
|
summary: Makes http fun! Also, makes consuming restful web services dead easy.
|