Features
-
(cache): Attempt a
GET
match inCache.lookup
method with incomingHEAD
request (#44): 1a27c9c
When the incoming request is a HEAD method, try to look for its GET counterpart in the Cache.API.add('GET', '/articles', async (req, res) => { // heavy DB query processing, etc const items = await expensive('task'); res.send(200, items); }); // BEFORE // --- // request -> "GET /articles" -> Cache MISS -> execute -> Cache PUT -> Response // request -> "GET /articles" -> Cache HIT -> Response // request -> "HEAD /articles" -> Cache HIT -> execute -> Cache PUT -> Response // AFTER // --- // request -> "GET /articles" -> Cache MISS -> execute -> Cache PUT -> Response // request -> "GET /articles" -> Cache HIT -> Response // request -> "HEAD /articles" -> Cache HIT -> Response
Patches
-
(router): Prevent early exit via
compose
inprepare
hook (#43): a1ab931
When usingcompose()
to create a$.prepare
handler, a Response was always returned from$.prepare
, preventing any/all route handlers from running. This has been fixed. -
(cache): Do not try to
Cache.put
forHEAD
requests (#44): e69859c
This technically was throwing at runtime error, which didn't affect the Response – thanks toevent.waitUntil
.