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 +4 -4
- data/lib/parliament/request/base_request.rb +10 -7
- data/lib/parliament/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f419f54660e3b063f13a428e6acffdabf7d6d82
|
4
|
+
data.tar.gz: '091aafe3c454b3285b5baeee9bea302560fbe7ef'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
request = Net::HTTP::Post.new(
|
143
|
+
endpoint_uri.request_uri,
|
144
|
+
'Content-Type' => 'application/json'
|
145
|
+
)
|
146
146
|
|
147
|
-
|
148
|
-
|
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
|
data/lib/parliament/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|