在Gupshup IDE上发出http Post请求有效吗?

编程入门 行业动态 更新时间:2024-10-22 15:30:23
本文介绍了在Gupshup IDE上发出http Post请求有效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我复制了gupshup的文档代码,并仅将URL修改为" posttestserver/post.php ",它不起作用.

I copied gupshup's document code and modified just url as "posttestserver/post.php" and it doesn't work.

有人对我有建议吗?

else if(event.message.toLowerCase() == "post") { var contextParam = { "User": { "userName": "sbCobxxxx", "Password": "xxxxxxx-9f-4307-9d9a-451f3xxxx075", "Pin": "16776" } }; var url = "posttestserver/post.php"; var param = JSON.stringify(contextParam); var header = {"Content-Type": "application/json"}; context.simplehttp.makePost(url, param, header); } function HttpResponseHandler(context, event) { // if(event.geturl === "ip-api/json") context.sendResponse(event.getresp); }

响应返回空字符串:"

Response returns empty string: ""

提前谢谢.

推荐答案

您是否正在使用Gupshup的模拟器进行测试?如果是,则到目前为止,带有标头和参数的POST和GET调用在模拟器中无法正常工作. 文档对此进行了提及.但是,您可以在Facebook Messenger上使用 Gupshup代理机器人部署并测试该代码会很好的工作. 这是我将您的代码直接复制到IDE后进行的测试的屏幕截图.

Are you testing using Gupshup's emulator? If yes then POST and GET calls with headers and params doesn't work in the emulator as of now. The documentations mentions it. However, you can deploy the code and test it out using Gupshup proxy bot on Facebook messenger and it will work fine. Here is a screenshot of the testing I did after directly copying your code into the IDE.

更多推荐

在Gupshup IDE上发出http Post请求有效吗?

本文发布于:2023-06-05 19:40:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/526454.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:IDE   Gupshup   Post   http

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!