request.params 在 onRequest 扩展中返回 null 即使请求中有参数

问题描述

我想在 onRequest 扩展中获得传递的参数,但我总是得到 null.. 当我想在我的应用程序的其他函数中访问它们时,我可以得到它们,

当我想在 onRequest 扩展中使用它们时出现问题 我正在使用 Hapi Js 框架

这是代码

const init = async function () {
  await server.register({
    plugin: HapiOpenAPI,options: openAPIOptions,});

  server.ext([
    {
      type: "onRequest",method: async (request,h) => {
        RequestLogger.logRequest(request);
        let {params} = request;
        console.log('Params',params);        
        return h.continue;
      },},]);
  await server.start();

  return server;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)