committee 4.1.0 → 4.2.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
  SHA256:
3
- metadata.gz: 9bef22bebc103d1bee78ba294078cd56e34e37da3e92b5cb89aba683a2361c74
4
- data.tar.gz: 76f012e3f28bd5275af941a372563f00b3bf68e1c0332d0e78affc18cbac9f2e
3
+ metadata.gz: 43984e56c905ff9e141e1ed49af5c9e51b07c39bda8bc268d195dc5799809d89
4
+ data.tar.gz: 76a6269ac7cc8237a63b2ae6c69ac512a60cecabaed7564dee88cd3adfa9328e
5
5
  SHA512:
6
- metadata.gz: da601220eca1ea05bb829a61a65bf6928262be27c73647de756f44b07329752efe6818be1a79b95bb51ad2e00025d08ff5fbb5410acfdc670d43f6816c6614f1
7
- data.tar.gz: c0fad32bef922020708c194065d0de90fccc9d33d00354b4c8a4f3208e18b4720030e01810e798107894e6f503e8145fef11fd12afa1ba1f0b5b017f3b58eeda
6
+ metadata.gz: f79ef24531c7b81489d12ea59e9da42e570236554a84c064c8478625e29167c3fef7245196a2c48d2a0a31ab33639417d47527321b321172f32c5f80fce5f46b
7
+ data.tar.gz: 68c8ad83aa2392ba1d31d440edb54b1301b6c37e093f7d466c0a9f406510a0efbdf6c9ea8aacf1ddf051fae31c03d2bd777accd90101bd321037dfdafd0affbf
@@ -11,9 +11,9 @@ module Committee
11
11
  end
12
12
 
13
13
  def handle(request)
14
- begin
15
- status, headers, response = @app.call(request.env)
14
+ status, headers, response = @app.call(request.env)
16
15
 
16
+ begin
17
17
  v = build_schema_validator(request)
18
18
  v.response_validate(status, headers, response) if v.link_exist? && self.class.validate?(status, validate_success_only)
19
19
 
@@ -457,6 +457,16 @@ describe Committee::Middleware::RequestValidation do
457
457
  end
458
458
  end
459
459
 
460
+ it 'does not suppress application error' do
461
+ @app = new_rack_app_with_lambda(lambda { |_|
462
+ JSON.load('-') # invalid json
463
+ }, schema: open_api_3_schema, raise: true)
464
+
465
+ assert_raises(JSON::ParserError) do
466
+ get "/error", nil
467
+ end
468
+ end
469
+
460
470
  private
461
471
 
462
472
  def new_rack_app(options = {})
@@ -215,6 +215,19 @@ describe Committee::Middleware::ResponseValidation do
215
215
  end
216
216
  end
217
217
 
218
+ it 'does not suppress application error' do
219
+ @app = Rack::Builder.new {
220
+ use Committee::Middleware::ResponseValidation, {schema: open_api_3_schema, raise: true}
221
+ run lambda { |_|
222
+ JSON.load('-') # invalid json
223
+ }
224
+ }
225
+
226
+ assert_raises(JSON::ParserError) do
227
+ get "/error", nil
228
+ end
229
+ end
230
+
218
231
  private
219
232
 
220
233
  def new_response_rack(response, headers = {}, options = {}, rack_options = {})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: committee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-06-27 00:00:00.000000000 Z
13
+ date: 2020-08-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json_schema