我有一个 REST 方法可以创建一个文档并返回 generateId。
@RequestMapping(value = "/document", method = RequestMethod.POST)
public String prelievo(
@RequestBody(required = true) Document document)
throws Exception {
return deliveryService.insertDocument(document);
}
该方法工作正常(我用邮递员对其进行了测试)但是当我使用 RestAngular 调用该方法时
this.Restangular.all('delivery/document').post(document)
我明白了
SyntaxError: Unexpected number
at Object.parse (native)
我认为问题在于 RestAngular 尝试将字符串转换为 Json 对象。我发现的唯一解决方案是返回字符串数组而不是单个对象。如何向 RestAngular 指定如何解析响应?