Commit 9d5fc3b7 authored by 任国军's avatar 任国军

wechat check

parent 44df3597
Pipeline #24424 passed with stage
in 4 seconds
......@@ -95,8 +95,26 @@ class WechatController extends Controller {
xmlData += '</xml>';
ctx.body = xmlData;
ctx.logger.info(ctx.req.xml);
ctx.logger.info(ctx.request.body);
let data = '';
ctx.req.setEncoding('utf8');
ctx.req.on('data', function(chunk) {
data += chunk;
});
const getxml = await new Promise(function(resolve) {
ctx.req.on('end', function() {
resolve(data);
});
});
const parseObj = await new Promise(function(resolve) {
xml2js(getxml, {
explicitArray: false,
}, function(err, json) {
resolve(json);
});
});
ctx.logger.info(JSON.stringify(parseObj));
ctx.logger.info(getxml);
return ctx.body;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment