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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f061610c664e42b9d4d712d08fff7ca07f544f9a
4
- data.tar.gz: 5e532cd3467fbb0e39bd8f87adc2364d505fbd5f
2
+ SHA256:
3
+ metadata.gz: 21274d1c09f3460352bc2aaf0cc00e6c0f9fb76eae45bc6dd0a65748c8d29463
4
+ data.tar.gz: c6900248181afef6fdf36381d4e33365345073a5a00f73498ac3e89259838f14
5
5
  SHA512:
6
- metadata.gz: 99deed9c0f2786c0afb4944badd7dca54739c21a8e7f30308ce432397f552e0d7cc641be5603828d82eda8f3d7d5290875f01e8d35e89c522dd0222e4a428247
7
- data.tar.gz: 691fc41871c19e7a2a3b220dbdb14165aa2aaa61439854822be74468d96caeaab96d874e6d6b41f0f95b226342250a2c7b45add712595d42640acd9bc0a4cd51
6
+ metadata.gz: 116978b76182751905d115a80ac0e350637564cad3c8d2bf8938ffcac99ff0e782bd810aa9889db3218ad147d38632c75fd85521682d22d7bb654de8cf1d0352
7
+ data.tar.gz: 2048e308a2d88288f9ab373f1472acd9955aeb7870c2a8cbfc128d0b71ace183bc7011a20f2f20ce7c2e37e400b4c9c6a3b695fc6dc36144e583a7151fc4a5e1
data/.rubocop_todo.yml CHANGED
@@ -15,7 +15,7 @@ Lint/EndAlignment:
15
15
  Enabled: false
16
16
 
17
17
  # Offense count: 1
18
- Lint/HandleExceptions:
18
+ Lint/SuppressedException:
19
19
  Enabled: false
20
20
 
21
21
  # Offense count: 5
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/648)
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
@@ -1,5 +1,7 @@
1
1
  # httparty
2
2
 
3
+ [![Build Status](https://travis-ci.org/jnunemaker/httparty.svg?branch=master)](https://travis-ci.org/jnunemaker/httparty)
4
+
3
5
  Makes http fun again! Ain't no party like a httparty, because a httparty don't stop.
4
6
 
5
7
  ## Install
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: (File.read("#{File.expand_path('.')}/path/to/certs/cert.pem"), "123456")
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:] 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
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.
@@ -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(value)
5
- case value
4
+ def add_cookies(data)
5
+ case data
6
6
  when Hash
7
- merge!(value)
7
+ merge!(data)
8
8
  when String
9
- value.split('; ').each do |cookie|
10
- array = cookie.split('=', 2)
11
- self[array[0].to_sym] = array[1]
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
 
@@ -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
- @raw_request.initialize_http_header(headers_hash)
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],
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module HTTParty
2
- VERSION = "0.17.1"
2
+ VERSION = "0.18.1"
3
3
  end
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.17.1
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: 2019-09-18 00:00:00.000000000 Z
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
- rubyforge_project:
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.