From 3c0bfeff9718ce9d0165ae4fefcda77d08c0710c Mon Sep 17 00:00:00 2001 From: DIYgod Date: Fri, 14 Jun 2019 11:14:24 +0800 Subject: [PATCH] feat: allow empty for certain routes --- lib/middleware/parameter.js | 2 +- lib/routes/appstore/price.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/middleware/parameter.js b/lib/middleware/parameter.js index 080f6aeb6..542ef8f39 100644 --- a/lib/middleware/parameter.js +++ b/lib/middleware/parameter.js @@ -3,7 +3,7 @@ const he = require('he'); module.exports = async (ctx, next) => { await next(); - if (ctx.state.data && (!ctx.state.data.item || ctx.state.data.item.length === 0)) { + 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'); } diff --git a/lib/routes/appstore/price.js b/lib/routes/appstore/price.js index 12e757a0e..fff806566 100644 --- a/lib/routes/appstore/price.js +++ b/lib/routes/appstore/price.js @@ -49,4 +49,5 @@ module.exports = async (ctx) => { link, item, }; + ctx.state.allowEmpty = true; };