diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d56499279..e7ac54e44b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support old price format in `ProductPrice` - @gibkigonzo (#3978) - Fixed product bundle comparison condition - @gk-daniel (#4004) - Keep registered payment methods after `syncTotals` - @grimasod (#4020) +- Added status code to the cache content and use it in cache response - @resubaka (#4014) ## [1.11.0] - 2019.12.20 diff --git a/core/scripts/server.ts b/core/scripts/server.ts index 361e745300..de6a8dc2ab 100755 --- a/core/scripts/server.ts +++ b/core/scripts/server.ts @@ -208,7 +208,7 @@ app.get('*', (req, res, next) => { if (config.server.useOutputCache && cache) { cache.set( 'page:' + req.url, - { headers: res.getHeaders(), body: output }, + { headers: res.getHeaders(), body: output, httpCode: res.statusCode }, tagsArray ).catch(errorHandler) } @@ -249,6 +249,11 @@ app.get('*', (req, res, next) => { } } res.setHeader('X-VS-Cache', 'Hit') + + if (output.httpCode) { + res.status(output.httpCode) + } + if (output.body) { res.end(output.body) } else {