Created
October 19, 2017 15:12
-
-
Save trezy/8e6d3db8f5a54e8c33da4b487abe51bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// `ctx` is an object that Koa.js passes through its middleware, allowing the | |
// middleware to modify it as they see fit. `ctx.request` and `ctx.response` are | |
// objects that reflect the contents of the HTTP request and response, | |
// respectively | |
var oldEtag = ctx.request.headers['if-none-match'] | |
var newEtag = ctx.response.headers['etag'] | |
ctx.fresh = (oldEtag !== newEtag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment