httparty 0.15.6 → 0.15.7

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
2
  SHA1:
3
- metadata.gz: e1263475e1be2f8d5150af07865061bc509a4bcc
4
- data.tar.gz: d531b6ddb71d9f04945f4136f519743e4f04e7d2
3
+ metadata.gz: 8dd9a56f1d2f44c1625e80e31683c4e14d333495
4
+ data.tar.gz: 41a140c3370a9ce0bceaaff0c07fa1ac32491660
5
5
  SHA512:
6
- metadata.gz: 07f2e819d9dd8892682d445dcd0f24e4b90f5d7f3bdbd763ffcb00da32602a5caf4b4da7b8b41df291500a7a0e67fac8bf8169b8cc37c398dbab93fff3da7957
7
- data.tar.gz: ea815b4c8982649e4927d3a83ab82faeb7bea6be4a5e8d459072c5fa5b7db55506f705eacf6bda1d32b3a7892c65a059da72e29fbb0e233e882f9734165cbb51
6
+ metadata.gz: 14861c965bdad3631ee5e4ae9e51e044e65f30d5884ce32571e0add19c1fb7ba8962e6119e40cc112928744477c4187ca01e7bd2c8764d7a8f2c69609d1ffbeb
7
+ data.tar.gz: 2918c91eef01e6f88a6d7cb905998d35a9c18589835cad7b5668ba47a2f549fd1dc15d6db08e73b031701fcd8021d955971e82707e3b8d9d37610da1de4eba6d
@@ -1,3 +1,16 @@
1
+ ## 0.15.7
2
+
3
+ Fixed
4
+
5
+ * [Add Response#pretty_print | Restore documented behavior](https://github.com/jnunemaker/httparty/pull/570)
6
+ * [Add ability to parse response from JSONAPI ](https://github.com/jnunemaker/httparty/pull/553)
7
+
8
+ ## 0.15.6
9
+
10
+ Fixed
11
+
12
+ * [Encoding and content type stuff](https://github.com/jnunemaker/httparty/pull/543)
13
+
1
14
  ## 0.15.5
2
15
 
3
16
  Fixed
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # httparty
2
2
 
3
- Makes http fun again!
3
+ Makes http fun again! Ain't no party like a httparty, because a httparty don't stop.
4
4
 
5
5
  ## Install
6
6
 
@@ -16,6 +16,6 @@ class HTTParty::CookieHash < Hash #:nodoc:
16
16
  end
17
17
 
18
18
  def to_cookie_string
19
- reject { |k, v| CLIENT_COOKIES.include?(k.to_s.downcase) }.collect { |k, v| "#{k}=#{v}" }.join("; ")
19
+ select { |k, v| !CLIENT_COOKIES.include?(k.to_s.downcase) }.collect { |k, v| "#{k}=#{v}" }.join("; ")
20
20
  end
21
21
  end
@@ -38,16 +38,17 @@ module HTTParty
38
38
  # @abstract Read the Custom Parsers section for more information.
39
39
  class Parser
40
40
  SupportedFormats = {
41
- 'text/xml' => :xml,
42
- 'application/xml' => :xml,
43
- 'application/json' => :json,
44
- 'text/json' => :json,
45
- 'application/javascript' => :plain,
46
- 'text/javascript' => :plain,
47
- 'text/html' => :html,
48
- 'text/plain' => :plain,
49
- 'text/csv' => :csv,
50
- 'application/csv' => :csv,
41
+ 'text/xml' => :xml,
42
+ 'application/xml' => :xml,
43
+ 'application/json' => :json,
44
+ 'application/vnd.api+json' => :json,
45
+ 'text/json' => :json,
46
+ 'application/javascript' => :plain,
47
+ 'text/javascript' => :plain,
48
+ 'text/html' => :html,
49
+ 'text/plain' => :plain,
50
+ 'text/csv' => :csv,
51
+ 'application/csv' => :csv,
51
52
  'text/comma-separated-values' => :csv
52
53
  }
53
54
 
@@ -276,8 +276,10 @@ module HTTParty
276
276
  end
277
277
 
278
278
  def encode_with_ruby_encoding(body, charset)
279
+ # NOTE: This will raise an argument error if the
280
+ # charset does not exist
279
281
  encoding = Encoding.find(charset)
280
- body.force_encoding(charset)
282
+ body.force_encoding(encoding.to_s)
281
283
  rescue ArgumentError
282
284
  body
283
285
  end
@@ -67,6 +67,14 @@ module HTTParty
67
67
  end
68
68
  end
69
69
 
70
+ def pretty_print(pp)
71
+ if !parsed_response.nil? && parsed_response.respond_to?(:pretty_print)
72
+ parsed_response.pretty_print(pp)
73
+ else
74
+ super
75
+ end
76
+ end
77
+
70
78
  def display(port=$>)
71
79
  if !parsed_response.nil? && parsed_response.respond_to?(:display)
72
80
  parsed_response.display(port)
@@ -1,3 +1,3 @@
1
1
  module HTTParty
2
- VERSION = "0.15.6"
2
+ VERSION = "0.15.7"
3
3
  end
@@ -373,6 +373,12 @@ RSpec.describe HTTParty::Request do
373
373
  end
374
374
  end
375
375
 
376
+ it 'should handle application/vnd.api+json' do
377
+ ["application/vnd.api+json", "application/vnd.api+json; charset=iso8859-1"].each do |ct|
378
+ expect(@request.send(:format_from_mimetype, ct)).to eq(:json)
379
+ end
380
+ end
381
+
376
382
  it 'should handle application/json' do
377
383
  ["application/json", "application/json; charset=iso8859-1"].each do |ct|
378
384
  expect(@request.send(:format_from_mimetype, ct)).to eq(:json)
@@ -40,8 +40,8 @@ RSpec.describe HTTParty::Response do
40
40
  expect(@response.code).to eq(@response_object.code)
41
41
  end
42
42
 
43
- it "should set code as a Fixnum" do
44
- expect(@response.code).to be_an_instance_of(Fixnum)
43
+ it "should set code as an Integer" do
44
+ expect(@response.code).to be_a(Integer)
45
45
  end
46
46
 
47
47
  context 'when raise_on is supplied' do
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.15.6
4
+ version: 0.15.7
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: 2017-07-21 00:00:00.000000000 Z
12
+ date: 2018-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_xml
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  requirements: []
152
152
  rubyforge_project:
153
- rubygems_version: 2.5.2
153
+ rubygems_version: 2.6.8
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: Makes http fun! Also, makes consuming restful web services dead easy.