且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Play中获取原始请求正文?

更新时间:2023-11-14 22:15:40

通过使用Action.async(parse.raw)然后执行req.body.asBytes().map(_.utf8String).getOrElse("")以获得正文的原始字符串来解决此问题.更多信息:https://www.playframework.com/documentation/2.7.x/ScalaBodyParsers

Solved this by using Action.async(parse.raw) and then doing req.body.asBytes().map(_.utf8String).getOrElse("") to obtain the raw string of the body. Some more info: https://www.playframework.com/documentation/2.7.x/ScalaBodyParsers