{"action":"created","issue":{"url":"https://api.github.com/repos/node-webot/wechat/issues/164","labels_url":"https://api.github.com/repos/node-webot/wechat/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/node-webot/wechat/issues/164/comments","events_url":"https://api.github.com/repos/node-webot/wechat/issues/164/events","html_url":"https://github.com/node-webot/wechat/issues/164","id":70025428,"number":164,"title":"用 sails 使用wechat ，读不到流","user":{"login":"hongxiyu","id":8132101,"avatar_url":"https://avatars.githubusercontent.com/u/8132101?v=3","gravatar_id":"","url":"https://api.github.com/users/hongxiyu","html_url":"https://github.com/hongxiyu","followers_url":"https://api.github.com/users/hongxiyu/followers","following_url":"https://api.github.com/users/hongxiyu/following{/other_user}","gists_url":"https://api.github.com/users/hongxiyu/gists{/gist_id}","starred_url":"https://api.github.com/users/hongxiyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hongxiyu/subscriptions","organizations_url":"https://api.github.com/users/hongxiyu/orgs","repos_url":"https://api.github.com/users/hongxiyu/repos","events_url":"https://api.github.com/users/hongxiyu/events{/privacy}","received_events_url":"https://api.github.com/users/hongxiyu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-04-22T05:03:59Z","updated_at":"2015-05-06T04:20:05Z","closed_at":"2015-05-03T07:43:53Z","body":"用 sails 框架使用 wechat，checkSignature 通过了，\r\n可是执行到 getMessage 的时候，就没有结果了\r\n\r\n``` javascript\r\nvar load = function (stream, callback) {\r\n  var buffers = [];\r\n\r\n// 得不到流\r\n  stream.on('data', function (trunk) {\r\n\t  console.log(\"on data  \"+ trunk);\r\n    buffers.push(trunk);\r\n  });\r\n  stream.on('end', function () {\r\n\t  console.log(\"on end\");\r\n    callback(null, Buffer.concat(buffers));\r\n  });\r\n\tconsole.log(\"on error\");\r\n  stream.once('error', callback);\r\n\tconsole.log(\"on error after\");\r\n\r\n};\r\n\r\n/*!\r\n * 从微信的提交中提取XML文件\r\n */\r\nvar getMessage = function (stream, callback) {\r\n  load(stream, function (err, buf) {\r\n    if (err) {\r\n\t    console.log(\"deal error\");\r\n      return callback(err);\r\n    }\r\n    var xml = buf.toString('utf-8');\r\n    stream.weixin_xml = xml;\r\n\t  console.log(\"xml  ---\" + xml);\r\n    xml2js.parseString(xml, {trim: true}, callback);\r\n  });\r\n};\r\n```\r\n\r\n请问是为什么会这样呢？有什么方法可以解决吗？"},"comment":{"url":"https://api.github.com/repos/node-webot/wechat/issues/comments/99316797","html_url":"https://github.com/node-webot/wechat/issues/164#issuecomment-99316797","issue_url":"https://api.github.com/repos/node-webot/wechat/issues/164","id":99316797,"user":{"login":"hongxiyu","id":8132101,"avatar_url":"https://avatars.githubusercontent.com/u/8132101?v=3","gravatar_id":"","url":"https://api.github.com/users/hongxiyu","html_url":"https://github.com/hongxiyu","followers_url":"https://api.github.com/users/hongxiyu/followers","following_url":"https://api.github.com/users/hongxiyu/following{/other_user}","gists_url":"https://api.github.com/users/hongxiyu/gists{/gist_id}","starred_url":"https://api.github.com/users/hongxiyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hongxiyu/subscriptions","organizations_url":"https://api.github.com/users/hongxiyu/orgs","repos_url":"https://api.github.com/users/hongxiyu/repos","events_url":"https://api.github.com/users/hongxiyu/events{/privacy}","received_events_url":"https://api.github.com/users/hongxiyu/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T04:20:05Z","updated_at":"2015-05-06T04:20:05Z","body":"谢谢，已经成功解决！"}}