wendux / fly

:rocket: Supporting request forwarding and Promise based HTTP client for all JavaScript runtimes.
https://wendux.github.io/dist/#/language
MIT License
3.9k stars 639 forks source link

fly + wx.requestSubscribeMessage = fail can only be invoked by user TAP gesture #275

Open tryingpzm opened 3 years ago

tryingpzm commented 3 years ago

操作路径:用户点击回调 -> await ajax -> wx.requestSubscribeMessage

ajax用flyio实现时会报错:requestSubscribeMessage:fail can only be invoked by user TAP gesture(开发者工具以及真机调试都报错),如果用原生或者 minapp-api-promise则不会,测试发现是内部setTimeout导致的,等于到了下个宏任务才执行,目前看来这触发了wx.requestSubscribeMessage判断是否用户真实点击的机制

导致问题代码: setTimeout(function () { engine.send(needQuery ? null : data); }, 0);