I have a RestController and a function that accepts post requests
@RequestMapping(path = "/auth",method = RequestMethod.POST)
public void authenticate(@RequestBody AuthenticationRequest authenticationRequest, HttpServletResponse httpServletResponse) throws IOException {
}
I try to issue a post request
mockMvc.perform(post("/auth")
.contentType(MediaType.APPLICATION_JSON)
.content("{ \"foo\": \"bar\", \"fruit\": \"apple\" }".getBytes()))
.andDo(print());
I receive
Resolved Exception:
Type = org.springframework.web.HttpMediaTypeNotSupportedException
Any workaround ideas?
Aucun commentaire:
Enregistrer un commentaire