Http Post request with content type application/x-www-form-urlencoded not working in Spring

后端 未结 7 1646
逝去的感伤
逝去的感伤 2020-11-27 06:19

Am new to spring currently am trying to do HTTP POST request application/x-www-form-url encoded but when i keep this in my headers then spring not recognizing it an

7条回答
  •  醉话见心
    2020-11-27 06:58

    You have to tell Spring what input content-type is supported by your service. You can do this with the "consumes" Annotation Element that corresponds to your request's "Content-Type" header.

    @RequestMapping(value = "/", method = RequestMethod.POST, consumes = {"application/x-www-form-urlencoded"})
    

    It would be helpful if you posted your code.

提交回复
热议问题