rails_twirp 0.15 → 0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +1 -3
- data/CHANGELOG.md +9 -5
- data/lib/rails_twirp/exception_handling.rb +1 -1
- data/lib/rails_twirp/mapper.rb +2 -2
- data/lib/rails_twirp/rescue.rb +2 -2
- data/lib/rails_twirp/testing/integration_test.rb +6 -3
- data/lib/rails_twirp/version.rb +1 -1
- data/rails_twirp.gemspec +3 -3
- metadata +6 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49a7d34d89a4dac62fb2125561c1b7aa3dc4fcbe429c13eb14d8cadc04d5ba39
|
4
|
+
data.tar.gz: '0491bab9e0a82bc44551047c4a1fe5969903e168e66cd1ab98635277a8e94013'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8320ba3215e7cdea0cf333611f3df86a5a134f8c2d61bac51b75a04cccd3f644f5b4cd690239ce4a4b42ad22429de88aacbfb5b40e8da67844145806625d675f
|
7
|
+
data.tar.gz: 0d6a125a57a4b709702c54db8d6ed1339d6f89f6c5e898b12136fb0ec1de3cb8ceeeede9bb9a040193240922fe00666aa5205b50c7075f118d989993c10d9620
|
data/.standard.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
### 0.
|
1
|
+
### 0.16
|
2
|
+
|
3
|
+
* Ensure `decode_rack_response` always calls `#close` on the Rack body in tests, as some middleware might be applying a BodyProxy
|
4
|
+
|
5
|
+
### 0.15
|
2
6
|
|
3
7
|
* Exclude versions of Rails 7 which were incompatible with the pbbuilder ActionView handler, as pbbuilder cannot work there at all
|
4
8
|
* Fix decode_rack_response to be compatible with Rack response body wrappers (and conform to the Rack SPEC)
|
5
9
|
|
6
|
-
### 0.14
|
10
|
+
### 0.14
|
7
11
|
* Adding frozen_string_literal: true to all files.
|
8
12
|
|
9
13
|
### 0.13.2
|
@@ -18,14 +22,14 @@
|
|
18
22
|
* Include `ActionController::Caching` with Base controller/helpers
|
19
23
|
|
20
24
|
|
21
|
-
### 0.12
|
25
|
+
### 0.12
|
22
26
|
|
23
27
|
* Allow a custom exception handling proc to be assigned using `RailsTwirp.unhandled_exception_handler`
|
24
28
|
|
25
|
-
### 0.11
|
29
|
+
### 0.11
|
26
30
|
|
27
31
|
* Update configuration and tests for Rails 7 compatibility
|
28
32
|
|
29
|
-
### 0.10
|
33
|
+
### 0.10
|
30
34
|
|
31
35
|
* Handle exceptions more like the Rails controllers do it, do not capture all of them as if they were Twirp exceptions
|
@@ -10,7 +10,7 @@ module RailsTwirp
|
|
10
10
|
|
11
11
|
def process_action(*)
|
12
12
|
super
|
13
|
-
rescue
|
13
|
+
rescue => e
|
14
14
|
# Only the exceptions which are not captured by ActionController-like "rescue_from" end up here.
|
15
15
|
# The idea is that any exception which is rescued by the controller is treated as part of the business
|
16
16
|
# logic, and thus taking action on it is the responsibility of the controller which uses "rescue_from".
|
data/lib/rails_twirp/mapper.rb
CHANGED
@@ -59,10 +59,10 @@ module RailsTwirp
|
|
59
59
|
@module = nil
|
60
60
|
end
|
61
61
|
|
62
|
-
def service(service_definition,
|
62
|
+
def service(service_definition, **kwargs, &block)
|
63
63
|
service_route_set = @route_set.services[service_definition]
|
64
64
|
service_mapper = ServiceMapper.new(service_route_set, self)
|
65
|
-
scope(**) { service_mapper.instance_exec(&block) }
|
65
|
+
scope(**kwargs) { service_mapper.instance_exec(&block) }
|
66
66
|
end
|
67
67
|
|
68
68
|
def scope(**options)
|
data/lib/rails_twirp/rescue.rb
CHANGED
@@ -91,14 +91,17 @@ module RailsTwirp
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def decode_rack_response(service, rpc, status, headers, body)
|
94
|
-
|
94
|
+
body_bytes = StringIO.new("".b)
|
95
|
+
body.each { |b| body_bytes << b }
|
95
96
|
|
96
97
|
if status === 200
|
97
98
|
output_class = service.rpcs[rpc][:output_class]
|
98
|
-
Twirp::Encoding.decode(
|
99
|
+
Twirp::Encoding.decode(body_bytes.string, output_class, headers["Content-Type"])
|
99
100
|
else
|
100
|
-
Twirp::Client.error_from_response(Response.new(status,
|
101
|
+
Twirp::Client.error_from_response(Response.new(status, body_bytes.string, headers))
|
101
102
|
end
|
103
|
+
ensure
|
104
|
+
body.close if body.respond_to?(:close) # Comply with Rack API
|
102
105
|
end
|
103
106
|
|
104
107
|
def set_controller_from_rack_env(env)
|
data/lib/rails_twirp/version.rb
CHANGED
data/rails_twirp.gemspec
CHANGED
@@ -13,10 +13,10 @@ Gem::Specification.new do |spec|
|
|
13
13
|
|
14
14
|
spec.files = `git ls-files`.split("\n")
|
15
15
|
|
16
|
-
# Rails has shipped an incompatible change in ActiveView, that was reverted in later versions
|
16
|
+
# Rails has shipped an incompatible change in ActiveView, that was reverted in later versions
|
17
|
+
# but at this time has not been released as a 7.x version
|
17
18
|
# @see https://github.com/rails/rails/pull/51023
|
18
|
-
|
19
|
-
spec.add_runtime_dependency "rails", ">= 6.1.3", *excluded_versions
|
19
|
+
spec.add_runtime_dependency "rails", ">= 6.1.3", " < 7.1"
|
20
20
|
spec.add_runtime_dependency "twirp", ">= 1.9", "< 1.11"
|
21
21
|
spec.required_ruby_version = ">= 3"
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_twirp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.16'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bouke van der Bijl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -17,18 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 6.1.3
|
20
|
-
- - "
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 7.1.0
|
23
|
-
- - "!="
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version: 7.1.1
|
26
|
-
- - "!="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: 7.1.2
|
29
|
-
- - "!="
|
20
|
+
- - "<"
|
30
21
|
- !ruby/object:Gem::Version
|
31
|
-
version: 7.1
|
22
|
+
version: '7.1'
|
32
23
|
type: :runtime
|
33
24
|
prerelease: false
|
34
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -36,18 +27,9 @@ dependencies:
|
|
36
27
|
- - ">="
|
37
28
|
- !ruby/object:Gem::Version
|
38
29
|
version: 6.1.3
|
39
|
-
- - "
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 7.1.0
|
42
|
-
- - "!="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: 7.1.1
|
45
|
-
- - "!="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 7.1.2
|
48
|
-
- - "!="
|
30
|
+
- - "<"
|
49
31
|
- !ruby/object:Gem::Version
|
50
|
-
version: 7.1
|
32
|
+
version: '7.1'
|
51
33
|
- !ruby/object:Gem::Dependency
|
52
34
|
name: twirp
|
53
35
|
requirement: !ruby/object:Gem::Requirement
|