UNPKG
koa-conditional-get
Version:
latest (3.0.0)
next (2.0.0)
v1 (1.0.4)
3.0.0
2.0.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
Conditional GET support for koa
github.com/koajs/conditional-get
koajs/conditional-get
koa-conditional-get
/
index.js
23 lines
(18 loc)
•
308 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'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
} } }