HttpEntity
HttpEntity
与使用 @RequestBody
几乎相同,但是基于公开请求标头和正文的容器对象。以下清单显示一个示例:
-
Java
-
Kotlin
@PostMapping("/accounts")
public void handle(HttpEntity<Account> entity) {
// ...
}
@PostMapping("/accounts")
fun handle(entity: HttpEntity<Account>) {
// ...
}