Moved to using GET and caching with SW

This commit is contained in:
Jori Lallo
2016-07-22 00:11:54 -07:00
parent 2669b27a08
commit e2c69903b3
9 changed files with 31 additions and 15 deletions

View File

@@ -0,0 +1,13 @@
import queryString from 'query-string';
export default function methodOverride(options) {
return async function methodOverrideMiddleware(ctx, next) {
if (ctx.method === 'POST') {
ctx.body = ctx.request.body;
} else {
ctx.method= 'POST';
ctx.body = queryString.parse(ctx.querystring);
}
return next();
}
};