twirp 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/twirp/encoding.rb +1 -1
- data/lib/twirp/version.rb +1 -1
- data/test/service_test.rb +9 -0
- data/twirp.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0046cb23f769232f34b2ec9b85961ee1311e59d68458b08539a0bb4f5789e83
|
4
|
+
data.tar.gz: dae8b79d9d9b05f95916f7676a228732f1ca3f3779174fde51a2a2f0e7b09f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db7e199e1a1593e4f6493fa8675018740d8d946f418ef02964c64d6a94b3410aa7ec1e79f5655fea89741cf65acbd0bce7003bdc844d9640d577b9a81ac27c24
|
7
|
+
data.tar.gz: db7a5ce35a8ca7b0b532594b0535c350f96667c4530830be14dfdb4016f142c21ff3939375183f7836d752ba3c31af70a910785829820b0ff7d1127f0b683c9a
|
data/lib/twirp/encoding.rb
CHANGED
@@ -23,7 +23,7 @@ module Twirp
|
|
23
23
|
|
24
24
|
def decode(bytes, msg_class, content_type)
|
25
25
|
case content_type
|
26
|
-
when JSON then msg_class.decode_json(bytes)
|
26
|
+
when JSON then msg_class.decode_json(bytes, ignore_unknown_fields: true)
|
27
27
|
when PROTO then msg_class.decode(bytes)
|
28
28
|
else raise ArgumentError.new("Invalid content_type")
|
29
29
|
end
|
data/lib/twirp/version.rb
CHANGED
data/test/service_test.rb
CHANGED
@@ -179,6 +179,15 @@ class ServiceTest < Minitest::Test
|
|
179
179
|
}, JSON.parse(body[0]))
|
180
180
|
end
|
181
181
|
|
182
|
+
def test_json_request_ignores_unknown_fields
|
183
|
+
rack_env = json_req "/example.Haberdasher/MakeHat", inches: 10, fake: 3
|
184
|
+
status, headers, body = haberdasher_service.call(rack_env)
|
185
|
+
|
186
|
+
assert_equal 200, status
|
187
|
+
assert_equal 'application/json', headers['Content-Type']
|
188
|
+
assert_equal({"inches" => 10, "color" => "white"}, JSON.parse(body[0]))
|
189
|
+
end
|
190
|
+
|
182
191
|
def test_bad_route_triggers_on_error_hooks
|
183
192
|
svc = haberdasher_service
|
184
193
|
|
data/twirp.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 1.9'
|
22
|
-
spec.add_runtime_dependency 'google-protobuf', '~> 3.0', '>= 3.
|
22
|
+
spec.add_runtime_dependency 'google-protobuf', '~> 3.0', '>= 3.7.0'
|
23
23
|
spec.add_runtime_dependency 'faraday', '< 2' # for clients
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twirp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyrus A. Forbes
|
@@ -9,28 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-protobuf
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0.0
|
21
18
|
- - "~>"
|
22
19
|
- !ruby/object:Gem::Version
|
23
20
|
version: '3.0'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.7.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- - ">="
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 3.0.0
|
31
28
|
- - "~>"
|
32
29
|
- !ruby/object:Gem::Version
|
33
30
|
version: '3.0'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.7.0
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: faraday
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|