diff --git a/core/server/api/canary/authentication.js b/core/server/api/canary/authentication.js index b907d3ba89..50a98b25a5 100644 --- a/core/server/api/canary/authentication.js +++ b/core/server/api/canary/authentication.js @@ -60,6 +60,9 @@ module.exports = { }, updateSetup: { + headers: { + cacheInvalidate: true + }, permissions: (frame) => { return models.User.findOne({role: 'Owner', status: 'all'}) .then((owner) => { diff --git a/core/server/api/canary/db.js b/core/server/api/canary/db.js index 9c391b2144..e4d3104af9 100644 --- a/core/server/api/canary/db.js +++ b/core/server/api/canary/db.js @@ -68,6 +68,9 @@ module.exports = { }, importContent: { + headers: { + cacheInvalidate: true + }, options: [ 'include' ], @@ -85,6 +88,9 @@ module.exports = { }, deleteAllContent: { + headers: { + cacheInvalidate: true + }, statusCode: 204, permissions: true, query() { diff --git a/core/server/api/canary/slugs.js b/core/server/api/canary/slugs.js index df51de6449..73d8ef8b2f 100644 --- a/core/server/api/canary/slugs.js +++ b/core/server/api/canary/slugs.js @@ -11,6 +11,9 @@ const allowedTypes = { module.exports = { docName: 'slugs', generate: { + headers: { + cacheInvalidate: true + }, options: [ 'include', 'type' diff --git a/core/server/api/canary/users.js b/core/server/api/canary/users.js index 3418662c92..6b9785a486 100644 --- a/core/server/api/canary/users.js +++ b/core/server/api/canary/users.js @@ -213,9 +213,6 @@ module.exports = { }, regenerateToken: { - headers: { - cacheInvalidate: true - }, options: [ 'id' ], diff --git a/test/api-acceptance/admin/db.test.js b/test/api-acceptance/admin/db.test.js index 35ed85e4ce..bfb86b673c 100644 --- a/test/api-acceptance/admin/db.test.js +++ b/test/api-acceptance/admin/db.test.js @@ -67,10 +67,11 @@ describe('DB API', function () { let jsonResponse = res.body; jsonResponse.posts.should.have.length(7); - await request.delete(localUtils.API.getApiQuery('db/')) + const deleteRequest = await request.delete(localUtils.API.getApiQuery('db/')) .set('Origin', config.get('url')) .set('Accept', 'application/json') .expect(204); + should.exist(deleteRequest.headers['x-cache-invalidate']); const res2 = await request.get(localUtils.API.getApiQuery('posts/')) .set('Origin', config.get('url')) diff --git a/test/api-acceptance/admin/slugs.test.js b/test/api-acceptance/admin/slugs.test.js index 1696179f18..0a551b72ee 100644 --- a/test/api-acceptance/admin/slugs.test.js +++ b/test/api-acceptance/admin/slugs.test.js @@ -20,7 +20,7 @@ describe('Slug API', function () { .expect('Cache-Control', testUtils.cacheRules.private) .expect(200); - should.not.exist(res.headers['x-cache-invalidate']); + should.exist(res.headers['x-cache-invalidate']); const jsonResponse = res.body; should.exist(jsonResponse); should.exist(jsonResponse.slugs); diff --git a/test/api-acceptance/admin/users.test.js b/test/api-acceptance/admin/users.test.js index e9ad3ddc21..fa5404ca10 100644 --- a/test/api-acceptance/admin/users.test.js +++ b/test/api-acceptance/admin/users.test.js @@ -314,6 +314,7 @@ describe('User API', function () { should.exist(res.body.apiKey); should.exist(res.body.apiKey.id); should.exist(res.body.apiKey.secret); + should.not.exist(res.headers['x-cache-invalidate']); should(res.body.id).not.be.equal(id); should(res.body.secret).not.be.equal(secret); diff --git a/test/regression/api/canary/admin/authentication.test.js b/test/regression/api/canary/admin/authentication.test.js index 4a112b9b87..eba6798455 100644 --- a/test/regression/api/canary/admin/authentication.test.js +++ b/test/regression/api/canary/admin/authentication.test.js @@ -124,6 +124,7 @@ describe('Authentication API v3', function () { const jsonResponse = res.body; should.exist(jsonResponse.users); should.not.exist(jsonResponse.meta); + should.exist(res.headers['x-cache-invalidate']); jsonResponse.users.should.have.length(1); localUtils.API.checkResponse(jsonResponse.users[0], 'user');