Giter VIP home page Giter VIP logo

Comments (6)

ihellodays avatar ihellodays commented on June 12, 2024

在调试进去,getRawBody 这个函数最后一行

return new Promise(function executor (resolve, reject) {
readStream(stream, encoding, length, limit, function onRead (err, buf) {
if (err) return reject(err)
resolve(buf)
})

resolve(buf)这里的buf输出是有内容的

就是上一层await不出来结果

from co-wechat.

ihellodays avatar ihellodays commented on June 12, 2024
    var xml = await getRawBody(ctx.req, {
      length: ctx.header.length,
      limit: '1mb',
      encoding: ctx.request.charset || 'utf-8'
    });

    console.log(xml);

后面一直都没有输出

from co-wechat.

JacksonTian avatar JacksonTian commented on June 12, 2024

我不知道你是怎么操作的啊,你用单元测试中的代码试试看?

from co-wechat.

ihellodays avatar ihellodays commented on June 12, 2024

用的是thinkjs框架
我们在controller 里面直接用

//公众号入口
async indexAction() {

    
    //post过来处理
    let appid = this.get('appid');
    let config= await this.model('mp').get(appid);
    let wetchat =  require('co-wechat')(config);

    await wetchat.middleware(async(msg) => {
        console.log( msg );

    })(this.ctx,()=>{});
    return true;
}

一直都没有返回 console.log( msg );

from co-wechat.

JacksonTian avatar JacksonTian commented on June 12, 2024

并没有针对 thinkjs 做过兼容。

from co-wechat.

JacksonTian avatar JacksonTian commented on June 12, 2024

出现问题应该是因为 request body 已经被解析了。

from co-wechat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.