UNPKG

koa-conditional-get

Version:
23 lines (18 loc) 308 B
'use strict' /** * Expose `conditional`. * * Conditional GET support middleware. * * @return {Function} * @api public */ module.exports = function conditional () { return async function (ctx, next) { await next() if (ctx.fresh) { ctx.status = 304 ctx.body = null } } }