我正在编写一个 DialogFlow 服务。
我的服务通过 API 网关接收 DialogFlow 履行请求,该 API 网关插入了一些我需要在我的服务中获取的额外授权标头。
我在代码中使用 DialogFlowApp handlerRequest 方法,但无法从 requestHandler 访问标头。
标头以通常的方式添加到 handleRequestMethod
@RequestMapping(value = "/google", method = RequestMethod.POST)
public String handleGoogle(@RequestBody String form, HttpServletRequest request) {
String jsonResponse = "";
try {
jsonResponse = google.handleRequest(form, getHeadersMap(request)).get();
} catch (Exception e) {
System.out.println("Error Resposnse "+e);
}
return jsonResponse;
}
我尝试使用以下方式访问标题:
public ActionResponse genericIntentHandler(ActionRequest request) {
Argument a = request.getArgument("someval");
//Or
Object b = request.getParameter("someval");
}
这些都不起作用。
查看github上的代码,请求处理程序似乎将标头添加到AogRequest类
但是,为创建类而调用的特定函数似乎对构造函数中的 headerMap 没有任何作用。
有人可以帮忙吗。