Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
3bfda09f
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3bfda09f
编写于
3月 11, 2016
作者:
S
Sean Griffin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22854 from jcoyne/missing_template
Default rendering behavior if respond_to collector doesn't have a block.
上级
e56b594d
48f140cf
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
23 addition
and
1 deletion
+23
-1
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+7
-0
actionpack/lib/action_controller/metal/mime_responds.rb
actionpack/lib/action_controller/metal/mime_responds.rb
+1
-1
actionpack/test/controller/mime/respond_to_test.rb
actionpack/test/controller/mime/respond_to_test.rb
+15
-0
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
3bfda09f
*
When a
`respond_to`
collector with a block doesn't have a response, then
a
`:no_content`
response should be rendered. This brings the default
rendering behavior introduced by https://github.com/rails/rails/issues/19036
to controller methods employing
`respond_to`
*Justin Coyne*
*
Add
`ActionController::Parameters#dig`
on Ruby 2.3 and greater, which
behaves the same as
`Hash#dig`
.
...
...
actionpack/lib/action_controller/metal/mime_responds.rb
浏览文件 @
3bfda09f
...
...
@@ -198,7 +198,7 @@ def respond_to(*mimes)
_process_format
(
format
)
_set_rendered_content_type
format
response
=
collector
.
response
response
?
response
.
call
:
render
({})
response
.
call
if
response
else
raise
ActionController
::
UnknownFormat
end
...
...
actionpack/test/controller/mime/respond_to_test.rb
浏览文件 @
3bfda09f
...
...
@@ -74,6 +74,14 @@ def using_defaults
end
end
def
missing_templates
respond_to
do
|
type
|
# This test requires a block that is empty
type
.
json
{
}
type
.
xml
end
end
def
using_defaults_with_type_list
respond_to
(
:html
,
:xml
)
end
...
...
@@ -624,6 +632,13 @@ def test_invalid_format
end
end
def
test_missing_templates
get
:missing_templates
,
format: :json
assert_response
:no_content
get
:missing_templates
,
format: :xml
assert_response
:no_content
end
def
test_invalid_variant
assert_raises
(
ActionController
::
UnknownFormat
)
do
get
:variant_with_implicit_template_rendering
,
params:
{
v: :invalid
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录