cacheable-response
Advanced tools
Comparing version
@@ -5,2 +5,9 @@ # Changelog | ||
### [2.0.4](https://github.com/Kikobeats/cacheable-response/compare/v2.0.3...v2.0.4) (2020-02-19) | ||
### Bug Fixes | ||
* save into cache under 304 response ([#43](https://github.com/Kikobeats/cacheable-response/issues/43)) ([c033b79](https://github.com/Kikobeats/cacheable-response/commit/c033b79058f131ddfe0946a0cf2f9a67c23c9470)) | ||
### [2.0.3](https://github.com/Kikobeats/cacheable-response/compare/v2.0.2...v2.0.3) (2020-02-18) | ||
@@ -7,0 +14,0 @@ |
12
index.js
@@ -117,2 +117,8 @@ 'use strict' | ||
if (!isHit) { | ||
const payload = { etag, createdAt, ttl, data, ...props } | ||
const value = await compress(payload) | ||
await cache.set(key, value, ttl) | ||
} | ||
if (!isModified) { | ||
@@ -124,8 +130,2 @@ res.statusCode = 304 | ||
if (!isHit) { | ||
const payload = { etag, createdAt, ttl, data, ...props } | ||
const value = await compress(payload) | ||
await cache.set(key, value, ttl) | ||
} | ||
return send({ data, res, req, ...props }) | ||
@@ -132,0 +132,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://nicedoc.io/Kikobeats/cacheable-response", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"main": "index.js", | ||
@@ -27,2 +27,6 @@ "author": { | ||
{ | ||
"name": "iKoala", | ||
"email": "iikoala@hotmail.com" | ||
}, | ||
{ | ||
"name": "rickynyairo", | ||
@@ -61,3 +65,3 @@ "email": "rickynyairo@gmail.com" | ||
"@commitlint/config-conventional": "latest", | ||
"ava": "latest", | ||
"ava": "~2.4.0", | ||
"ci-publish": "latest", | ||
@@ -64,0 +68,0 @@ "conventional-github-releaser": "latest", |
29604
1.38%