【发布时间】:2018-03-21 03:41:20
【问题描述】:
我需要使用给定的 API 定义,但我无法在 documentation 找到同时接受标头和请求正文的函数调用。请在此处建议使用 RestTemplate 的哪个功能。
@RequestMapping(value = "/createObject", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<CreateObjectOutput> createObject(
@RequestBody CreateObjectInput req)
{
CreateObjectOutput out = new CreateObjectOutput();
///// Some Code
return new ResponseEntity<CreateObjectOutput>(out, HttpStatus.OK);
}
【问题讨论】:
-
我也可以访问 API 定义。请提出定义本身是否有问题。