0

我是 spring 框架的新手,我想知道如何在 PUT 请求的主体中发送Lists UUID

我有以下端点:

@RequestMapping(path = "/v1/bulkDelete", method = RequestMethod.PUT)
public ResponseEntity<Void> bulkDelete(@RequestBody List<UUID> users) {
    myService.bulkDelete(users);
    return ResponseEntity.ok().build();
}

还有我的 json 身体:

{
   ["cddc9329-f1a8-4886-8fe7-b989b07352c0", "2377927c-ad03-43fa-a3b9-94d1400011c2"]
}

我得到的回应是:

{
    "status": 415,
    "error": "Unsupported Media Type",
    "message": "Content type 'text/plain;charset=UTF-8' not supported",
    "path": "/v1/bulkDelete"
}

为什么我会收到“不支持的媒体类型”错误?UUID 不能在请求正文中作为字符串发送吗?

4

0 回答 0