nifty-utils 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nifty/utils/http.rb +7 -1
- data/lib/nifty/utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5ad6e02aa55b0bb3a010db44422451fec700911
|
4
|
+
data.tar.gz: f8d9d4533a371c32e8b9297154527356ed8c1f30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85cb12e84b04661e4639e43e06825114049e8e2e99d5ad000a9db549d88a9b09336d8af4c682329ade4111748fac70e21a5b06307f2aeee0fed3e24426ddd92e
|
7
|
+
data.tar.gz: 675edba523278254391200fb39f4fc8a4408dfd37dd329cda57d88d0b595875bac676b5cc4315d4eb714dd179a95db060dfeb064e04e12d4ce1375d7cbf963d0
|
data/lib/nifty/utils/http.rb
CHANGED
@@ -49,9 +49,15 @@ module Nifty
|
|
49
49
|
timeout = options[:timeout] || 60
|
50
50
|
Timeout.timeout(timeout) do
|
51
51
|
result = connection.request(request)
|
52
|
+
if result.content_type == 'application/json'
|
53
|
+
body = JSON.parse(result.body)
|
54
|
+
else
|
55
|
+
body = result.body
|
56
|
+
end
|
52
57
|
{
|
53
58
|
:code => result.code.to_i,
|
54
|
-
:
|
59
|
+
:type => result.content_type,
|
60
|
+
:body => body
|
55
61
|
}
|
56
62
|
end
|
57
63
|
rescue SocketError, Errno::ECONNRESET, EOFError, Errno::EINVAL => e
|
data/lib/nifty/utils/version.rb
CHANGED