spring - 处理“curl ...-data”的Rest Endpoint
问题描述
我有一个 api,它应该可以像这样使用: curl ' http://localhost:8080/api/bla ' --data '{"comment":"something"}'。
因此,我创建了一个后端点,例如:
@RequestMapping(value = "/bla", produces = { "application/json" },
method = RequestMethod.POST)
public ResponseEntity<Token> getBla(@RequestParam String comment){}
但我收到一个错误必需的字符串参数“注释”不存在 我也尝试添加
@RequestParam(value="comment", required=true) String comment
有同样的错误。你能帮我看看这里有什么问题吗?
解决方案
推荐阅读
- python - 如何将小部件的 id 从 kivy 发送和使用到 python
- git - 尝试在两个本地存储库之间获取失败?
- android - 将 ImageView 固定到 LinearLayout 中最右侧的位置
- c - 如何修复“错误:赋值给数组类型的表达式”?
- java - 倒计时结束后恢复应用
- java - 双编码 UTF-8 字符串 - MySql,Hibernate
- python - 刮掉阿里巴巴的产品
- cmake - 在 macOS 上使用 Ninja 进行 CMake GUI
- reactjs - 在 create-react-app 托管服务器上使用代理的 Axios 发布不起作用
- html - 如何让我的图像一直拉伸?