首页 > 解决方案 > 如何从 Grails 中的 api 呈现 html 响应

问题描述

我正在调用第 3 方 api,它应该返回一个 html 响应。我怎样才能做出这样的回应,或者有另一种更好的方法来处理这个问题?

标签: grailsgsp

解决方案


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
}

推荐阅读