这个问题在这里已经有了答案:
Spring: Returning empty HTTP Responses with ResponseEntity<Void> doesn't work
(6 个回答)
去年关闭。
我想知道如果我返回一个空的 ResponseEntity,我的 Controller 的最佳返回类型是什么。
例如,如果我想使用 ResponseEntity.noContent().build()
返回 204 - 无内容应该返回我的函数ResponseEntity<?>
, ResponseEntity<Void>
或只是 ResponseEntity
最佳答案
ResponseEntity<Void> with HttpStatus.NO_CONTENT
关于java - 使用 Spring 返回空的 ResponseEntity 的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59987062/