mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
23 lines
308 B
JavaScript
23 lines
308 B
JavaScript
|
|
'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
|
|
}
|
|
}
|
|
}
|