[英]Change Knock gem return rails
Hello thank you for reading me, I am trying to change the default return from the knock gem of rails, it returns a json with just a jwt element. 您好,谢谢您的阅读,我正在尝试更改rails的gem的默认返回值,它只返回一个jwt元素的json。
{
"jwt": "token"
}
but I want to add elements to that response: 但我想在响应中添加元素:
{
"jwt": "token",
"my element": "element 2"
}
is it possible, or need to make another request using that token to return more data? 是否可能,或者需要使用该令牌发出另一个请求以返回更多数据?
If you could help me I will be very grateful, greetings. 如果您能帮助我,我将非常感谢。
Try this: 尝试这个:
render json: {
jwt: "token",
element: "you data",
}, status: :ok
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.