fix: retain allowEmpty in ctx.state (#2542)

* fix: retain allowEmpty in ctx.state

See: https://github.com/koajs/koa/issues/1172

* fix: pass test case allow_empty

* chore: get rid of eslint warning
This commit is contained in:
Henry Wang
2019-07-03 05:10:36 +01:00
committed by DIYgod
parent 569100cdb0
commit 9c837f1bc2
8 changed files with 10 additions and 11 deletions

View File

@@ -7,8 +7,8 @@ module.exports = async (ctx, next) => {
throw Error('wrong path');
}
if (ctx.state.data && (!ctx.state.data.item || ctx.state.data.item.length === 0) && !ctx.state.allowEmpty) {
throw Error('this route is empty, please check the origin site or create an issue to feedback on https://github.com/DIYgod/RSSHub/issues/new/choose');
if (ctx.state.data && (!ctx.state.data.item || ctx.state.data.item.length === 0) && !ctx.state.data.allowEmpty) {
throw Error('this route is empty, please check the original site or create an issue on https://github.com/DIYgod/RSSHub/issues/new/choose');
}
// decode HTML entities