grails - 如何从 Grails 中的 api 呈现 html 响应
问题描述
我正在调用第 3 方 api,它应该返回一个 html 响应。我怎样才能做出这样的回应,或者有另一种更好的方法来处理这个问题?
解决方案
If it's returning an HTML String, just render that directly (assuming you don't want to do anything with it). It's not clear to me this is actually what's happening, but if so...
def someAction() {
String htmlResponse = <api call>
render htmlResponse
}
推荐阅读
- python - 合并数据框中的 2 列
- excel-formula - 尝试从 Office JS 任务窗格插入 VSTO 插件公式时 Excel 崩溃
- r - 神经网络:选择了未定义的列
- reactjs - 即使出现错误,onCompleted 的 useMutation 也会被执行
- python - 允许从其他模块导入 python 模块
- javascript - 控制台中的下一个js错误_next/data/QPTTgJmZl2jVsyHQ_IfQH/blog/post/21/.json
- javascript - 如何从“FOR”循环中添加我的输出并求和
- python - 如何在这里正确使用列表?
- javascript - 如何使用 onClick 从 JSX 组件向反应函数组件传递参数
- java - 项目命令无法识别项目 Spigot