mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Update cache invalidation on several routes
issue https://github.com/TryGhost/Team/issues/859 - Added invalidation to PUT /authentication/setup - Added invalidation to POST /db - Added invalidation to DELETE /db - Added invalidation to GET /slugs/:type/:name - Removed invalidation from PUT /users/:id/token
This commit is contained in:
parent
360e8d08d4
commit
605b042a33
8 changed files with 17 additions and 5 deletions
|
@ -60,6 +60,9 @@ module.exports = {
|
|||
},
|
||||
|
||||
updateSetup: {
|
||||
headers: {
|
||||
cacheInvalidate: true
|
||||
},
|
||||
permissions: (frame) => {
|
||||
return models.User.findOne({role: 'Owner', status: 'all'})
|
||||
.then((owner) => {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -11,6 +11,9 @@ const allowedTypes = {
|
|||
module.exports = {
|
||||
docName: 'slugs',
|
||||
generate: {
|
||||
headers: {
|
||||
cacheInvalidate: true
|
||||
},
|
||||
options: [
|
||||
'include',
|
||||
'type'
|
||||
|
|
|
@ -213,9 +213,6 @@ module.exports = {
|
|||
},
|
||||
|
||||
regenerateToken: {
|
||||
headers: {
|
||||
cacheInvalidate: true
|
||||
},
|
||||
options: [
|
||||
'id'
|
||||
],
|
||||
|
|
|
@ -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'))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Add table
Reference in a new issue