gpt4 book ai didi

ruby-on-rails - Rails 请求返回状态 200 但没有响应数据

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:22:47 25 4
gpt4 key购买 nike

我有一个 rails Action 如下:

def create
......
if @course.save
render json: { success: true, course: @course.info}
else
render json: { success: false, error_msg: @course.errors.full_messages }
end

请求返回状态200但无响应数据。

enter image description here enter image description here

nginx 日志和 rails 日志看起来正常:

# nginx log
100.116.224.40 [14/Aug/2018:18:59:12 +0800] POST "xxxxx" 200 200 27
"47.88.138.112" xxx

# rails log
method=POST path=xxxxformat=*/* controller=xxxx action=create
status=200 duration=45.94 view=0.23 params=

最佳答案

因为 course 大概是一个散列,尝试 course["info"]

如果仍然无效,您可能需要使用 JSON.parse(course["info"])将信息哈希转换为 JSON

关于ruby-on-rails - Rails 请求返回状态 200 但没有响应数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51841093/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com