feat: retrun JSON data for pkg

This commit is contained in:
DIYgod 2019-09-18 18:36:37 +08:00
parent 8b99be4e5f
commit 2aa847c71c
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
2 changed files with 8 additions and 3 deletions

View File

@ -61,8 +61,12 @@ module.exports = async (ctx, next) => {
atomlink: ctx.request.href,
...ctx.state.data,
};
if (template) {
ctx.body = art(template, data);
if (config.isPackage) {
ctx.body = data;
} else {
if (template) {
ctx.body = art(template, data);
}
}
}
};

View File

@ -24,8 +24,9 @@ module.exports = {
},
{
setHeader: () => {},
removeHeader: () => {},
end: (data) => {
resolve(data);
resolve(JSON.parse(data));
},
}
);