rack-json_schema 1.1.0 → 1.1.1

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: b28c973a0a7e88414ff495f23a4d4d74da9c3024
4
- data.tar.gz: 17c6b63a58ad58f66db57f43266890ac633f67c2
3
+ metadata.gz: 41f8287d3451b2c931c11e3a97fe178bb8492e78
4
+ data.tar.gz: 4d65340993f231235b36b7e5aa0accd80f9e2e06
5
5
  SHA512:
6
- metadata.gz: afcd17fe0f1bef5a94cf54a43deb42d6ddbb4b4d5db371e68571153ed12a76b11a75c9f3701eff176f789a60604dce4a397effba8d7beeb1ba77c0e20833ba28
7
- data.tar.gz: 8bb15acd2a2f91be390215cf9a1c495e3f0982583ed62bda3bda7f4927c0682caca02aea73aa16d3161d044f0fe54c1815e0dc48664af281e3a07ca84372e526
6
+ metadata.gz: d7a782f3eb739cbcf32400d202cc6518e5740e2209ff858992fa89491d5f7ef7a39a316beaf305c2a7b3f4dad5065c04cb74591d6cf4660397e6570b51ce1e6c
7
+ data.tar.gz: c0a326a2a4e83edf3ae2ecd147886c4370027088e241aac17b23f526d2eb01aa1ad3b14fe2ad25eb62ecea9664b4bd8f2b0f7ae83d3f052a160e081d74bebb5e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.1
2
+ * Skip response validation if response code is 4xx or 5xx
3
+
1
4
  ## 1.1.0
2
5
  * GET /docs returns HTML
3
6
 
@@ -31,7 +31,7 @@ module Rack
31
31
  # Raises an error if any error detected, skipping validation for non-defined link
32
32
  # @raise [Rack::JsonSchema::ResponseValidation::InvalidResponse]
33
33
  def call
34
- if has_link_for_current_action?
34
+ if !has_error_status? && has_link_for_current_action?
35
35
  case
36
36
  when !has_json_content_type?
37
37
  raise InvalidResponseContentType
@@ -82,6 +82,17 @@ module Rack
82
82
  @response[2].each {|str| result << str }
83
83
  result
84
84
  end
85
+
86
+ # @return [Fixnum] Response status code
87
+ def response_status
88
+ @response[0]
89
+ end
90
+
91
+ # Skips validation if status code is equal to or larger than 400
92
+ # @return [Fixnum]
93
+ def has_error_status?
94
+ response_status >= 400
95
+ end
85
96
  end
86
97
 
87
98
  # Base error class for Rack::JsonSchema::ResponseValidation
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module JsonSchema
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-22 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis