Skip to content

Commit 1fb0c45

Browse files
committed
fix: only cache GET requests
1 parent 0637c9c commit 1fb0c45

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class CacheResponses {
1818
}
1919

2020
async middleware(ctx, next) {
21+
if (ctx.method !== 'GET') return next();
22+
2123
if (!_.isFunction(ctx.cashed))
2224
throw new Error(
2325
'Please ensure you have set up `koa-cash` properly, see https://github.com/koajs/cash for more info.'

0 commit comments

Comments
 (0)