const cloud = require( 'wx-server-sdk' ); var request = require( 'request' ); cloud.init() exports.main = async (event, context) => { var options = { method: 'post' , preambleCRLF: true , postambleCRLF: true , uri: 'https://www.baidu.com' , multipart: [ { body: 'I am nodejs request messages' } ] }; var result = {}; var isReturn = false ; request(options, function (error, response, body) { if (error) { return console.error( 'upload failed:' , error); } result = body; isReturn = true ; console.log( "post done" ); }); var i = 0; while (isReturn !== true ){ console.log( "whileing" ); i++; } console.log( "want to return" ); return result; } |
这是我在服务端写的一段测试代码,发现http请求根本发不出去,每次都超时。是不是云开发禁止发http请求的 如果是的话 要如何支付呢
可以的,我已经跑通云支付了。
可参考
https://developers.weixin.qq.com/community/develop/doc/0002cc8ccbc30073044701a4b51c00?jumpto=comment&commentid=000808c98cc040a60847b7c1e5b0