mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 21:47:57 +08:00
test: route cache in middleware/cache
This commit is contained in:
@@ -86,35 +86,8 @@ router.get('/', async (ctx) => {
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/test/:id', (ctx) => {
|
||||
if (ctx.params.id === '0') {
|
||||
throw Error('Error test');
|
||||
}
|
||||
const item = [];
|
||||
if (ctx.params.id === 'long') {
|
||||
item.push({
|
||||
title: `Long Title `.repeat(10),
|
||||
description: `Long Description `.repeat(10),
|
||||
pubDate: new Date(`2018-3-1`).toUTCString(),
|
||||
link: `https://github.com/DIYgod/RSSHub/issues/0`,
|
||||
author: `DIYgod0`,
|
||||
});
|
||||
}
|
||||
for (let i = 1; i < 6; i++) {
|
||||
item.push({
|
||||
title: `Title${i}`,
|
||||
description: `Description${i}`,
|
||||
pubDate: new Date(`2018-4-${i}`).toUTCString(),
|
||||
link: `https://github.com/DIYgod/RSSHub/issues/${i}`,
|
||||
author: `DIYgod${i}`,
|
||||
});
|
||||
}
|
||||
ctx.state.data = {
|
||||
title: `Test ${ctx.params.id}`,
|
||||
link: 'https://github.com/DIYgod/RSSHub',
|
||||
item: item,
|
||||
};
|
||||
});
|
||||
// test
|
||||
router.get('/test/:id', require('./routes/test'));
|
||||
|
||||
// RSSHub
|
||||
router.get('/rsshub/rss', require('./routes/rsshub/rss'));
|
||||
|
||||
Reference in New Issue
Block a user