responders 3.2.0 → 3.2.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/MIT-LICENSE +1 -1
- data/README.md +2 -2
- data/lib/action_controller/responder.rb +21 -9
- data/lib/responders/version.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85caa4a2e0a2c40a2a902204e3770f87770e0e9897df78380e8f9f20c114599d
|
|
4
|
+
data.tar.gz: 4d5ef6e453e4a7931f03d460a3d47e017d040d1e6becc560136de6ca39ce82ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44b1bd3400b1b1a8605966621bde0766e8b4b4ed5742f8cafd214304c60c0790988900ee30f881aed21884ca11d47258773404be3518049b6e34905822b5fad2
|
|
7
|
+
data.tar.gz: 5519dbfb23019487eda15ca485f38213aabd4abf8ec9e276c8a161e634429b9bb369a7989dee2f280b527c98f8020df8a5e779a2fa3270b367b5138ec23dcdfa
|
data/CHANGELOG.md
CHANGED
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Responders
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/rb/responders)
|
|
4
4
|
|
|
5
5
|
A set of responders modules to dry up your Rails app.
|
|
6
6
|
|
|
@@ -290,5 +290,5 @@ If you discover any bugs or want to drop a line, feel free to create an issue on
|
|
|
290
290
|
## License
|
|
291
291
|
|
|
292
292
|
MIT License.
|
|
293
|
-
Copyright 2020-
|
|
293
|
+
Copyright 2020-CURRENT Rafael França, Carlos Antonio da Silva.
|
|
294
294
|
Copyright 2009-2019 Plataformatec.
|
|
@@ -103,6 +103,11 @@ module ActionController # :nodoc:
|
|
|
103
103
|
#
|
|
104
104
|
# respond_with(@project, location: root_path)
|
|
105
105
|
#
|
|
106
|
+
# If the location is an external URL, pass <code>allow_other_host: true</code>
|
|
107
|
+
# to permit the redirect (this is forwarded to <code>redirect_to</code>):
|
|
108
|
+
#
|
|
109
|
+
# respond_with(@project, location: "https://example.com/", allow_other_host: true)
|
|
110
|
+
#
|
|
106
111
|
# To customize the failure scenario, you can pass a block to
|
|
107
112
|
# <code>respond_with</code>:
|
|
108
113
|
#
|
|
@@ -187,14 +192,14 @@ module ActionController # :nodoc:
|
|
|
187
192
|
# responds to :to_format and display it.
|
|
188
193
|
#
|
|
189
194
|
def to_format
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
begin
|
|
196
|
+
if !get? && has_errors? && !response_overridden?
|
|
197
|
+
return display_errors
|
|
198
|
+
elsif has_view_rendering? || response_overridden?
|
|
199
|
+
return default_render
|
|
200
|
+
end
|
|
201
|
+
rescue ActionView::MissingTemplate
|
|
196
202
|
end
|
|
197
|
-
rescue ActionView::MissingTemplate
|
|
198
203
|
api_behavior
|
|
199
204
|
end
|
|
200
205
|
|
|
@@ -207,7 +212,7 @@ module ActionController # :nodoc:
|
|
|
207
212
|
elsif has_errors? && default_action
|
|
208
213
|
render error_rendering_options
|
|
209
214
|
else
|
|
210
|
-
redirect_to navigation_location,
|
|
215
|
+
redirect_to navigation_location, redirect_options
|
|
211
216
|
end
|
|
212
217
|
end
|
|
213
218
|
|
|
@@ -281,7 +286,8 @@ module ActionController # :nodoc:
|
|
|
281
286
|
|
|
282
287
|
# Check whether the necessary Renderer is available
|
|
283
288
|
def has_renderer?
|
|
284
|
-
Renderers
|
|
289
|
+
renderers = Renderers.respond_to?(:all) ? Renderers.all : Renderers::RENDERERS
|
|
290
|
+
renderers.include?(format)
|
|
285
291
|
end
|
|
286
292
|
|
|
287
293
|
def has_view_rendering?
|
|
@@ -314,5 +320,11 @@ module ActionController # :nodoc:
|
|
|
314
320
|
{ action: default_action, status: error_status }
|
|
315
321
|
end
|
|
316
322
|
end
|
|
323
|
+
|
|
324
|
+
def redirect_options
|
|
325
|
+
redirect_options = { status: redirect_status }
|
|
326
|
+
redirect_options[:allow_other_host] = options[:allow_other_host] if options.key?(:allow_other_host)
|
|
327
|
+
redirect_options
|
|
328
|
+
end
|
|
317
329
|
end
|
|
318
330
|
end
|
data/lib/responders/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: responders
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.2.
|
|
4
|
+
version: 3.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- José Valim
|
|
@@ -37,6 +37,20 @@ dependencies:
|
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '7.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rails-controller-testing
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
40
54
|
- !ruby/object:Gem::Dependency
|
|
41
55
|
name: mocha
|
|
42
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +66,21 @@ dependencies:
|
|
|
52
66
|
- !ruby/object:Gem::Version
|
|
53
67
|
version: '0'
|
|
54
68
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name:
|
|
69
|
+
name: rake
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: rdoc
|
|
56
84
|
requirement: !ruby/object:Gem::Requirement
|
|
57
85
|
requirements:
|
|
58
86
|
- - ">="
|
|
@@ -110,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
110
138
|
- !ruby/object:Gem::Version
|
|
111
139
|
version: '0'
|
|
112
140
|
requirements: []
|
|
113
|
-
rubygems_version:
|
|
141
|
+
rubygems_version: 4.0.16
|
|
114
142
|
specification_version: 4
|
|
115
143
|
summary: A set of Rails responders to dry up your application
|
|
116
144
|
test_files: []
|