diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lib/wechat.js b/lib/wechat.js index bd253d87..7056bc56 100644 --- a/lib/wechat.js +++ b/lib/wechat.js @@ -119,8 +119,11 @@ var load = function (stream, callback) { // support content-type 'text/xml' using 'express-xml-bodyparser', which set raw xml string // to 'req.rawBody'(while latest body-parser no longer set req.rawBody), see // https://github.com/macedigital/express-xml-bodyparser/blob/master/lib/types/xml.js#L79 - if (stream.rawBody) { - callback(null, stream.rawBody); + // support restify req.body + + var body = stream.rawBody || stream.body; + if (body) { + callback(null, body); return; }