在 nodejs webhook 端点中添加对 hal+json 的支持

问题描述

我一直在使用 freescout 购票。现在我需要将我的 nodejs 端点作为 webhook 集成到其中。

我尝试使用它,freescout 总是在指定事件上命中我的端点,但始终 request.body 为空。

FreeScout 发送这些标头

Headers

我无法在 req.body 中获得 nodejs 但是当我在 PHP 中尝试相同时它工作并在 req.body 中返回了我的完整对象

PHP代码如下

header('Content-Type: application/json');
$request = file_get_contents('PHP://input');
$req_dump = print_r($request,true);
$fp = file_put_contents('request.log',$req_dump);

在节点上我正在使用 express,所以我厌倦了添加 bodyparser.json() cors 但没有任何效果

解决方法

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

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

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