是否可以让 Play Framework 1 在 post 请求中处理发送的 JSON?连接到后端的开发人员不想发送带有 & 符号作为分隔符的键/值对,他想发送 JSON。问题是数据为空,即为name
空。这有可能实现吗?
到目前为止我所拥有的:
控制器
public static void myMethod(String name) {
Logger.info(name);
}
路由文件
POST /test Application.myMethod
我发送带有标题的请求Content-Type: application/json
和正文中的数据{
"name": "A name"
}