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 +4 -4
- data/Changelog.md +13 -0
- data/README.md +1 -1
- data/lib/httparty/cookie_hash.rb +1 -1
- data/lib/httparty/parser.rb +11 -10
- data/lib/httparty/request.rb +3 -1
- data/lib/httparty/response.rb +8 -0
- data/lib/httparty/version.rb +1 -1
- data/spec/httparty/request_spec.rb +6 -0
- data/spec/httparty/response_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dd9a56f1d2f44c1625e80e31683c4e14d333495
|
4
|
+
data.tar.gz: 41a140c3370a9ce0bceaaff0c07fa1ac32491660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14861c965bdad3631ee5e4ae9e51e044e65f30d5884ce32571e0add19c1fb7ba8962e6119e40cc112928744477c4187ca01e7bd2c8764d7a8f2c69609d1ffbeb
|
7
|
+
data.tar.gz: 2918c91eef01e6f88a6d7cb905998d35a9c18589835cad7b5668ba47a2f549fd1dc15d6db08e73b031701fcd8021d955971e82707e3b8d9d37610da1de4eba6d
|
data/Changelog.md
CHANGED
@@ -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
data/lib/httparty/cookie_hash.rb
CHANGED
@@ -16,6 +16,6 @@ class HTTParty::CookieHash < Hash #:nodoc:
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def to_cookie_string
|
19
|
-
|
19
|
+
select { |k, v| !CLIENT_COOKIES.include?(k.to_s.downcase) }.collect { |k, v| "#{k}=#{v}" }.join("; ")
|
20
20
|
end
|
21
21
|
end
|
data/lib/httparty/parser.rb
CHANGED
@@ -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'
|
42
|
-
'application/xml'
|
43
|
-
'application/json'
|
44
|
-
'
|
45
|
-
'
|
46
|
-
'
|
47
|
-
'text/
|
48
|
-
'text/
|
49
|
-
'text/
|
50
|
-
'
|
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
|
|
data/lib/httparty/request.rb
CHANGED
@@ -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(
|
282
|
+
body.force_encoding(encoding.to_s)
|
281
283
|
rescue ArgumentError
|
282
284
|
body
|
283
285
|
end
|
data/lib/httparty/response.rb
CHANGED
@@ -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)
|
data/lib/httparty/version.rb
CHANGED
@@ -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
|
44
|
-
expect(@response.code).to
|
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.
|
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:
|
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.
|
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.
|