邮递员 "status" : 415, "error" : "Unsupported Media Type" ,



我试图创建一个类,在那里我可以将客户端(cliente(添加到类(aula(

@RequestMapping(value = "/aulas/{numero}/{numerocliente}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity<Object> addClienteAula(@PathVariable("numero") int nraula, @PathVariable("numerocliente") int nrclente) {
try {
AulaService.addAlunoAula(nraula, nrclente);
return new ResponseEntity<>(HttpStatus.CREATED);
} catch (Exception e) {
return new ResponseEntity<>(new ErroDTO(e), HttpStatus.CONFLICT);
}
}

这是我对邮递员的请求:
http://localhost:8080/api/aulas/1/23

结果是这样的:

{
"timestamp": "2020-04-25T00:12:02.300+0000",
"status": 415,
"error": "Unsupported Media Type",
"message": "Content type 'text/plain' not supported",
"path": "/api/aulas/1/23"
}

在邮递员的请求头中提及您的内容类型

Content-Type application/xml