我们可以编写查询解析器层,如下所示
@DgsData(parentType = "Query", field = "answersByQuestionUuid")
public List<Answer> answersByQuestionUuid(@InputArgument("questionUuid") UUID questionUuid,
@InputArgument("enhancedContent") boolean enhancedContent,
@InputArgument("templateName") String templateName) {
if (enhancedContent) {
return getStructuredAnswersByQuestionUUID(questionUuid.toString(), templateName);
}
return getAnswersByQuestionUUID(questionUuid);
}如何在解析器中获取HTTP标头。
发布于 2021-03-22 01:50:51
除了DGS输入参数之外,您还可以使用Spring框架中的@RequestHeader注释来接收HTTP请求头值。例如:
public List<Answer> answersByQuestionUuid(@InputArgument("questionUuid") UUID questionUuid,
@RequestHeader("Content-Type") String contentType) {https://stackoverflow.com/questions/66721496
复制相似问题