low_type 0.8.6 → 0.8.7
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 +4 -4
- data/lib/adapters/sinatra_adapter.rb +6 -9
- data/lib/type_expression.rb +1 -0
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94ec8cf1ae80a7540248e9a0a97e2e9bbc99fb81724f9a89e3d35de0ccd3dfaa
|
|
4
|
+
data.tar.gz: f1bf339671b5d17ec247814a08ea665aca64df51f404f625dff5d6bf77cf7c2e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a6ff0fa4038f53cd1650f27e7523ec2e0c0ac75c66190d62d976dbaded7887c2dc1900cb514709255af87f1c01545eb7c0748c100cd8133ea947c3d03f0c785
|
|
7
|
+
data.tar.gz: 141e666816a66e0446b0d9559d288dc24b7e838c200537fbfd5b18297533f8812517e37e29d3bcf7388efbef82fffb1aa90a6407037c4803db8bc6a1b26645f8
|
|
@@ -51,9 +51,7 @@ module LowType
|
|
|
51
51
|
proxy.type_expression.types.each do |type|
|
|
52
52
|
value = SinatraAdapter.reconstruct_return_value(type:, response:)
|
|
53
53
|
unless proxy.type_expression.validate(value:, proxy:)
|
|
54
|
-
|
|
55
|
-
body(proxy.error_message(value: value.inspect))
|
|
56
|
-
break
|
|
54
|
+
halt 500, {}, proxy.error_message(value: value.inspect)
|
|
57
55
|
end
|
|
58
56
|
end
|
|
59
57
|
end
|
|
@@ -72,12 +70,11 @@ module LowType
|
|
|
72
70
|
HTML => -> (response) { response.body.first },
|
|
73
71
|
JSON => -> (response) { response.body.first },
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
[
|
|
80
|
-
[Integer, Hash, String] => -> (response) { [response.status, response.headers, *response.body] },
|
|
73
|
+
[String] => -> (response) { response.body }, # Body is stored internally as an array.
|
|
74
|
+
[Integer, String] => -> (response) { [response.status, response.body.first] },
|
|
75
|
+
[Integer, Hash, String] => -> (response) { [response.status, response.headers, response.body.first] },
|
|
76
|
+
|
|
77
|
+
# TODO: Represent Enumerable[T]. How would we match a Module of a class in a hash key?
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
raise AllowedTypeError, 'Did you mean "Response.finish"?' if type.to_s == 'Response'
|
data/lib/type_expression.rb
CHANGED
data/lib/version.rb
CHANGED