我有一个RestApi暴露,在案件返回状态ok回到客户端。
方法的方法签名是ResponseEntity<void> methodName(){}
。
这个方法是deleteApi。
在仅使用responseEntity
创建的返回Status OK
中,不会附加任何正文或任何其他标题详细信息。
在调用时我看到ClientProtocolException
的日志中,看到当通过REST客户端(邮递员)执行相同操作时,在响应中收到了正确的Status OK
消息。
ClientProtocolException
被提出的原因是什么?
如果返回类型为ResponeEntity<Void>
,是否必须向其发送正文?
如何避免上述异常?
代码:
@RequestMapping(method = RequestMethod.DELETE)
public ResponseEntity<Void> methodName()
{
// your buisness logic
return new ResponseEntity<Void>(HttpStatus.OK);
}
答案 0 :(得分:0)
尝试如下
[5 6 7 8] is shape (4,)
[[5 6 7 8]] is shape (1, 4)
[[5 6 7 8]] is shape (1, 4)
[[5 6 7 8]] is shape (1, 4)