nifty-utils 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cd572d9cee5d232284ee6891b65d54322cc6e97
4
- data.tar.gz: af7c8916f38893ca045c5fa08f68e3f282b1a973
3
+ metadata.gz: b5ad6e02aa55b0bb3a010db44422451fec700911
4
+ data.tar.gz: f8d9d4533a371c32e8b9297154527356ed8c1f30
5
5
  SHA512:
6
- metadata.gz: 7dc0e5e08d837e9fc8bd9f41ab1f07d7d75b4cde6b113b08cfeca24154159cb94db5c35541fdeb5feaffc52e8c5528726a357309478725cd2693ff92cc01e00f
7
- data.tar.gz: a40ba6cb5fc8cbb38508df409c6df1e748301f47ee93c37dc7609db300baf431b21a33a576aac1c4f2f23f3b23171fe30eda15f861970550f9d29e37a848c98a
6
+ metadata.gz: 85cb12e84b04661e4639e43e06825114049e8e2e99d5ad000a9db549d88a9b09336d8af4c682329ade4111748fac70e21a5b06307f2aeee0fed3e24426ddd92e
7
+ data.tar.gz: 675edba523278254391200fb39f4fc8a4408dfd37dd329cda57d88d0b595875bac676b5cc4315d4eb714dd179a95db060dfeb064e04e12d4ce1375d7cbf963d0
@@ -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
- :body => result.body
59
+ :type => result.content_type,
60
+ :body => body
55
61
  }
56
62
  end
57
63
  rescue SocketError, Errno::ECONNRESET, EOFError, Errno::EINVAL => e
@@ -1,5 +1,5 @@
1
1
  module Nifty
2
2
  module Utils
3
- VERSION = '1.1.5'
3
+ VERSION = '1.1.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nifty-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke