parliament-ruby 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cd8ab1c11e6470f8abfe331460e88a27dbb744e
4
- data.tar.gz: 38b07e70b348261edca867875f58046e00e750ef
3
+ metadata.gz: 2f419f54660e3b063f13a428e6acffdabf7d6d82
4
+ data.tar.gz: '091aafe3c454b3285b5baeee9bea302560fbe7ef'
5
5
  SHA512:
6
- metadata.gz: 4fc5d91fd689c2586d0e48255a09804f0b099268b2cced988294e2fc01fd7989c06fdc0a90ab1e75719442d8637b653956adc9b56f67de26185f4072d10253ed
7
- data.tar.gz: 74298480dd4af4d1d69716b7067a5f2d1110ec20659fafb1394b109ca7daffe2b10f24be811fcd97004db2bd5a2e17611efe04295fb85fb4d73e2aa8e80a31dc
6
+ metadata.gz: 57934dfbca235a92f3c137b26e830aff49c4554dfc55174c93b54691af9b623b32f9d3b547d71c688fd8595065465f74d9ec13da829c74243a2beaa69b816a5d
7
+ data.tar.gz: 89a98cb8baf500233969c283e6fbdf43596f6628385584a68990ce805f8febe65f15e47d9bc4f11d4439e941ef3a6a18b51d6e07f373f2f13405269b515e7334
@@ -139,13 +139,16 @@ module Parliament
139
139
  http = Net::HTTP.new(endpoint_uri.host, endpoint_uri.port)
140
140
  http.use_ssl = true if endpoint_uri.scheme == 'https'
141
141
 
142
- net_response = http.start do |h|
143
- api_request = Net::HTTP::Post.new(endpoint_uri.request_uri)
144
- add_headers(api_request)
145
- api_request.body = body unless body.nil?
142
+ request = Net::HTTP::Post.new(
143
+ endpoint_uri.request_uri,
144
+ 'Content-Type' => 'application/json'
145
+ )
146
146
 
147
- h.request api_request
148
- end
147
+ add_headers(request)
148
+
149
+ request.body = body unless body.nil?
150
+
151
+ net_response = http.request(request)
149
152
 
150
153
  handle_errors(net_response)
151
154
 
@@ -182,7 +185,7 @@ module Parliament
182
185
  def handle_errors(net_response)
183
186
  case net_response
184
187
  when Net::HTTPOK # 2xx Status
185
- exception_class = Parliament::NoContentResponseError if net_response['Content-Length'] == '0'
188
+ exception_class = Parliament::NoContentResponseError if net_response['Content-Length'] == '0' || (net_response['Content-Length'].nil? && net_response.body.nil?)
186
189
  when Net::HTTPClientError # 4xx Status
187
190
  exception_class = Parliament::ClientError
188
191
  when Net::HTTPServerError # 5xx Status
@@ -1,3 +1,3 @@
1
1
  module Parliament
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.10.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Rayner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-19 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler