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