Hapi JS post 请求负载解析问题

Hapi JS post request payload parsing issue

我正在使用 HapiJS 11,现在升级到 HapiJS 16。更新时我遇到了与有效负载解析相关的问题。

HapiJS 11 中,我得到的有效负载为

{
 "profile":{
   "name": <name>,
   "email": <email>
 }
}

但在 HapiJS 16 我得到的是

{
 "profile[name]": <name>,
 "profile[email]": <email>
}

我得到了问题的解决方案。

实际上从版本 13 Hapi JS 中删除了解析查询参数、有效负载数据作为核心功能,要解析这些我们需要添加一个插件 hapi-qshapi

来源:Hapi 13 release summary

其他来源:

https://github.com/hapijs/hapi/issues/1317

https://github.com/hapijs/discuss/issues/425