当前,我在将WebhookRequest解析到我们的端点时面临挑战,并且产生的错误如下。
{
"timestamp": 1548256930107,
"status": 415,
"error": "Unsupported Media Type",
"exception": "org.springframework.web.HttpMediaTypeNotSupportedException",
"message": "Content type 'application/json;charset=UTF-8' not supported",
"path": "/api/v2/whrwebhooktest"
}
该请求的内容类型为标头中的 application / json ,并在以下请求签名处被接收。
@RequestMapping(value = "/whrwebhoo", method = RequestMethod.POST, , consumes="application/json;charset=UTF-8")
@ResponseBody
public WebhookResponse processWebhook(@RequestBody WebhookRequest request, @RequestHeader(value = "Authorization") String token) {
.............
return webhookResponse
}
请求正文带有示例json https://developers.google.com/actions/build/json/dialogflow-webhook-json
我还尝试了@RequestMapping来消耗= {MediaType.APPLICATION_JSON}而不是消耗==“ application / json; charset = UTF-8”,但是没有运气。
感谢您的帮助。