gpt4 book ai didi

node.js - Node 红色 "no response object"

转载 作者:太空宇宙 更新时间:2023-11-04 02:57:32 25 4
gpt4 key购买 nike

我正在尝试创建一个http get Node ,该 Node 获取表单数据,然后使用rest API 创建一个到另一个网站的http post。我能够让 http 调用返回正确的有效负载,但是 http 响应 Node 在调试选项卡中给出“无响应对象”错误,并且客户端永远不会返回。我是否特别需要执行某些操作来传递响应对象,以便调用将正确的响应对象发送到 http 响应 Node ?

流程如下:[{"id":"7011e7a9.8fee18","type":"http 请求","name":"","method":"use","re​​t":"obj","url":"","x":499,"y":84,"z":"51693a88.ae96c4","wires":[["efea497c.1015b8"] ]},{"id":"589f2a18.a760d4","type":"function","name":"","func":"var myprocess = context.global.process;\nmyprocess.env.NODE_TLS_REJECT_UNAUTHORIZED =\"0\";\nvar dev_url =\"https://website.com:22411/central/api/qracore/browses?browseId=mfg:gp239\";\n\nvar msg = {\n\"method\":\"GET\",\n\"url\": dev_url,\n\"headers\": {\n\"Authorization\":\"Basic abWZnQHFhZC5jb206=\",\n\"Origin\":\"mybox.com\"\n }\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":323,"y":154,"z":"51693a88.ae96c4","wires":[["7011e7a9.8fee18"]]},{"id":"9f65b624.609a48","type":"debug","name":"","active": true,"console":"false","complete":"payload","x":810,"y":211,"z":"51693a88.ae96c4","wires":[]},{"id":"38e4c04d.c71b4","type":"http in","name":"","url":"/workOrders","method":"get ","swaggerDoc":"","x":152,"y":190,"z":"51693a88.ae96c4","wires":[["589f2a18.a760d4"]]},{"id":"e5ee54b2.1a11a8","type":"http响应","name":"","x":770,"y":96,"z":"51693a88.ae96c4","wires":[]},{"id":"efea497c.1015b8","type":"function","name":"","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","输出":1,"noerr":0,"x ":582,"y":214,"z":"51693a88.ae96c4","电线":[["e5ee54b2.1a11a8","9f65b624.609a48"]]}]

最佳答案

关键是将其从 Node 传递到另一个 Node 。您可以通过使用消息中的 req 和 res 传递到输出来完成此操作。

var newMsg = { payload: msg.payload };
//return [msg, newMsg];

newMsg.user = msg.req.body["user"];
newMsg.req = msg.req;
newMsg.res = msg.res;

return newMsg;

关于node.js - Node 红色 "no response object",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34504325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com