0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

🐛 Fixed missing cache invalidation header when uploading redirects (#9071)

closes #9065
This commit is contained in:
Katharina Irrgang 2017-09-27 19:58:33 +02:00 committed by Kevin Ansfield
parent fcd3c6847b
commit a6d57d6324
2 changed files with 8 additions and 3 deletions

View file

@ -83,7 +83,7 @@ cacheInvalidationHeader = function cacheInvalidationHeader(req, result) {
if (endpoint === 'schedules' && subdir === 'posts') {
return INVALIDATE_ALL;
}
if (['settings', 'users', 'db', 'tags'].indexOf(endpoint) > -1) {
if (['settings', 'users', 'db', 'tags', 'redirects'].indexOf(endpoint) > -1) {
return INVALIDATE_ALL;
} else if (endpoint === 'posts') {
if (method === 'DELETE') {

View file

@ -55,6 +55,7 @@ describe('Redirects API', function () {
res.headers['content-disposition'].should.eql('Attachment; filename="redirects.json"');
res.headers['content-type'].should.eql('application/json; charset=utf-8');
should.not.exist(res.headers['x-cache-invalidate']);
// API returns an empty file with the correct file structure (empty [])
res.headers['content-length'].should.eql('2');
@ -137,7 +138,9 @@ describe('Redirects API', function () {
.expect('Content-Type', /application\/json/)
.expect(200);
})
.then(function () {
.then(function (res) {
res.headers['x-cache-invalidate'].should.eql('/*');
return request
.get('/k/')
.expect(302);
@ -194,7 +197,9 @@ describe('Redirects API', function () {
.expect('Content-Type', /application\/json/)
.expect(200);
})
.then(function () {
.then(function (res) {
res.headers['x-cache-invalidate'].should.eql('/*');
return request
.get('/my-old-blog-post/')
.expect(404);