Spring MVC @RequestMapping headers can accept only one value?

前端 未结 2 1811
渐次进展
渐次进展 2020-12-08 08:03

This will work:

@RequestMapping(value = \"/test\", method = RequestMethod.POST,
    headers = {\"content-type=application/json\"}) {
    .......
}

2条回答
  •  醉酒成梦
    2020-12-08 08:27

    Have you tried doing content-type=application/json,application/xml?

    Not sure if it would work but putting two content-type headers in there I think only one will win.

    OR

    possibily use two RequestMapping annotations on the same method with different content-type headers?

提交回复
热议问题