-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用上传临时素材接口的时候,返回 一段buffer #19
Comments
具体接口? |
uploadMedia api.uploadMedia('filepath', type); {"type":"TYPE","media_id":"MEDIA_ID","created_at":123456789} exports.uploadVoice(filepath); 方法 exports.uploadMedia() |
@JacksonTian co接口是不是有问题,我刚才试了下callback方式的 是正常的 |
分两次输出 |
为何会是2次? |
单独请求。把根wechat的关联挪开。 var result = yield api.uploadMedia() |
@JacksonTian 我遇到和vimer 同样的问题,
总是报: |
@logerzhu 我用callback形式了 |
@vimer 我重写了request方法,然后好了
|
@只能在5.5以下的版本使用,在5.5和5.5以上的版本就失效了,所以如果是5.5或者以上的可以用CURLFile这个 |
@JacksonTian 我也遇到同样的问题,调试了一下感觉是使用httpx库的文件数据没有写进去,data属性接受String|Buffer,而form是个流对象。如果直接改造request函数是否会对其他函数有影响 |
@miwoy httpx的opts.data可以是一个Stream啊。 |
@JacksonTian 我没看他的源码,只看了文档说接受String|Buffer,这个接口确实不能用,返回一段buffer,解码后是{"errcode":41005,"errmsg":"media data missing hint: [dR0571sz59]"},而同样的参数es5版本的接口是正常的,您可以测试一下,我的node版本是v6.2.0,co-wechat-api版本是v2.3.1 |
@JacksonTian 我引用了楼上那位大神的代码,上传接口可以了,但是会影响下载接口,于是我封装了一个给上传用的request专用接口 |
@miwoy pull request |
uploadMedia可用的,await api.uploadMedia(buffer, 'image', 'test.jpg', ‘image/jpeg’);,但是返回的数据是 buffer,需要先 JSON.parse(buffer),才能获取到 media_id |
按照官方的api,及co-wechat-api不是也是应该返回json吗? 然后我用JSON.parse来解析 得到的结果是 {"errcode":41005,"errmsg":"media data missing"}
The text was updated successfully, but these errors were encountered: