restify 1.10.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +135 -53
- data/README.md +10 -12
- data/lib/restify/adapter/em.rb +6 -8
- data/lib/restify/adapter/pooled_em.rb +36 -40
- data/lib/restify/adapter/typhoeus.rb +69 -47
- data/lib/restify/context.rb +4 -4
- data/lib/restify/error.rb +48 -0
- data/lib/restify/global.rb +2 -2
- data/lib/restify/link.rb +4 -4
- data/lib/restify/processors/base.rb +2 -6
- data/lib/restify/processors/base/parsing.rb +2 -6
- data/lib/restify/promise.rb +2 -3
- data/lib/restify/relation.rb +1 -0
- data/lib/restify/request.rb +13 -5
- data/lib/restify/resource.rb +1 -1
- data/lib/restify/timeout.rb +2 -3
- data/lib/restify/version.rb +1 -1
- data/spec/restify/context_spec.rb +2 -2
- data/spec/restify/error_spec.rb +70 -0
- data/spec/restify/features/head_requests_spec.rb +5 -6
- data/spec/restify/features/request_bodies_spec.rb +83 -0
- data/spec/restify/features/request_headers_spec.rb +6 -7
- data/spec/restify/features/response_errors_spec.rb +127 -0
- data/spec/restify/global_spec.rb +2 -2
- data/spec/restify_spec.rb +50 -57
- data/spec/spec_helper.rb +12 -12
- data/spec/support/stub_server.rb +102 -0
- metadata +24 -13
- data/spec/restify/features/response_errors.rb +0 -79
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -56,16 +56,22 @@ dependencies:
|
|
56
56
|
name: hashie
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.3'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '5.0'
|
62
65
|
type: :runtime
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
|
-
- - "
|
69
|
+
- - ">="
|
67
70
|
- !ruby/object:Gem::Version
|
68
71
|
version: '3.3'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '5.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rack
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,16 +146,16 @@ dependencies:
|
|
140
146
|
name: bundler
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
142
148
|
requirements:
|
143
|
-
- - "
|
149
|
+
- - ">="
|
144
150
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
151
|
+
version: '0'
|
146
152
|
type: :development
|
147
153
|
prerelease: false
|
148
154
|
version_requirements: !ruby/object:Gem::Requirement
|
149
155
|
requirements:
|
150
|
-
- - "
|
156
|
+
- - ">="
|
151
157
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
158
|
+
version: '0'
|
153
159
|
description: An experimental hypermedia REST client that uses parallel, keep-alive
|
154
160
|
and pipelined requests by default.
|
155
161
|
email:
|
@@ -186,9 +192,11 @@ files:
|
|
186
192
|
- lib/restify/version.rb
|
187
193
|
- spec/restify/cache_spec.rb
|
188
194
|
- spec/restify/context_spec.rb
|
195
|
+
- spec/restify/error_spec.rb
|
189
196
|
- spec/restify/features/head_requests_spec.rb
|
197
|
+
- spec/restify/features/request_bodies_spec.rb
|
190
198
|
- spec/restify/features/request_headers_spec.rb
|
191
|
-
- spec/restify/features/
|
199
|
+
- spec/restify/features/response_errors_spec.rb
|
192
200
|
- spec/restify/global_spec.rb
|
193
201
|
- spec/restify/link_spec.rb
|
194
202
|
- spec/restify/processors/base_spec.rb
|
@@ -201,6 +209,7 @@ files:
|
|
201
209
|
- spec/restify/timeout_spec.rb
|
202
210
|
- spec/restify_spec.rb
|
203
211
|
- spec/spec_helper.rb
|
212
|
+
- spec/support/stub_server.rb
|
204
213
|
homepage: https://github.com/jgraichen/restify
|
205
214
|
licenses:
|
206
215
|
- LGPL-3.0+
|
@@ -213,24 +222,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
222
|
requirements:
|
214
223
|
- - ">="
|
215
224
|
- !ruby/object:Gem::Version
|
216
|
-
version:
|
225
|
+
version: 2.5.0
|
217
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
227
|
requirements:
|
219
228
|
- - ">="
|
220
229
|
- !ruby/object:Gem::Version
|
221
230
|
version: '0'
|
222
231
|
requirements: []
|
223
|
-
|
224
|
-
rubygems_version: 2.7.8
|
232
|
+
rubygems_version: 3.2.22
|
225
233
|
signing_key:
|
226
234
|
specification_version: 4
|
227
235
|
summary: An experimental hypermedia REST client.
|
228
236
|
test_files:
|
229
237
|
- spec/restify/cache_spec.rb
|
230
238
|
- spec/restify/context_spec.rb
|
239
|
+
- spec/restify/error_spec.rb
|
231
240
|
- spec/restify/features/head_requests_spec.rb
|
241
|
+
- spec/restify/features/request_bodies_spec.rb
|
232
242
|
- spec/restify/features/request_headers_spec.rb
|
233
|
-
- spec/restify/features/
|
243
|
+
- spec/restify/features/response_errors_spec.rb
|
234
244
|
- spec/restify/global_spec.rb
|
235
245
|
- spec/restify/link_spec.rb
|
236
246
|
- spec/restify/processors/base_spec.rb
|
@@ -243,3 +253,4 @@ test_files:
|
|
243
253
|
- spec/restify/timeout_spec.rb
|
244
254
|
- spec/restify_spec.rb
|
245
255
|
- spec/spec_helper.rb
|
256
|
+
- spec/support/stub_server.rb
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Restify do
|
6
|
-
let!(:request_stub) do
|
7
|
-
stub_request(:get, 'http://localhost/base')
|
8
|
-
.to_return do
|
9
|
-
<<-RESPONSE.gsub(/^ {8}/, '')
|
10
|
-
HTTP/1.1 #{http_status}
|
11
|
-
Content-Length: 333
|
12
|
-
Transfer-Encoding: chunked
|
13
|
-
Link: <http://localhost/other>; rel="neat"
|
14
|
-
RESPONSE
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:http_status) { '200 OK' }
|
19
|
-
|
20
|
-
describe 'Error handling' do
|
21
|
-
subject(:request) { Restify.new('http://localhost/base').get.value! }
|
22
|
-
|
23
|
-
context 'for 400 status codes' do
|
24
|
-
let(:http_status) { '400 Bad Request' }
|
25
|
-
|
26
|
-
it 'throws a BadRequest exception' do
|
27
|
-
expect { request }.to raise_error Restify::BadRequest
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'for 401 status codes' do
|
32
|
-
let(:http_status) { '401 Unauthorized' }
|
33
|
-
|
34
|
-
it 'throws an Unauthorized exception' do
|
35
|
-
expect { request }.to raise_error Restify::Unauthorized
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'for 404 status codes' do
|
40
|
-
let(:http_status) { '404 Not Found' }
|
41
|
-
|
42
|
-
it 'throws a ClientError exception' do
|
43
|
-
expect { request }.to raise_error Restify::NotFoundError
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'for 406 status codes' do
|
48
|
-
let(:http_status) { '406 Not Acceptable' }
|
49
|
-
|
50
|
-
it 'throws a NotAcceptable exception' do
|
51
|
-
expect { request }.to raise_error Restify::NotAcceptable
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'for 422 status codes' do
|
56
|
-
let(:http_status) { '422 Unprocessable Entity' }
|
57
|
-
|
58
|
-
it 'throws a UnprocessableEntity exception' do
|
59
|
-
expect { request }.to raise_error Restify::UnprocessableEntity
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'for any other 4xx status codes' do
|
64
|
-
let(:http_status) { '415 Unsupported Media Type' }
|
65
|
-
|
66
|
-
it 'throws a generic ClientError exception' do
|
67
|
-
expect { request }.to raise_error Restify::ClientError
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'for any 5xx status codes' do
|
72
|
-
let(:http_status) { '500 Internal Server Error' }
|
73
|
-
|
74
|
-
it 'throws a generic ServerError exception' do
|
75
|
-
expect { request }.to raise_error Restify::ServerError
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|