Adding author pages to cache invalidation

This commit is contained in:
Hannah Wolfe 2014-08-10 18:57:47 +01:00
parent d210e400b0
commit d556f4723e
2 changed files with 7 additions and 3 deletions

View File

@ -80,7 +80,7 @@ cacheInvalidationHeader = function (req, result) {
// Don't set x-cache-invalidate header for drafts
if (hasStatusChanged || wasDeleted || wasPublishedUpdated) {
cacheInvalidate = '/, /page/*, /rss/, /rss/*, /tag/*';
cacheInvalidate = '/, /page/*, /rss/, /rss/*, /tag/*, /author/*';
if (id && post.slug) {
return config.urlForPost(settings, post).then(function (postUrl) {
return cacheInvalidate + ', ' + postUrl;

View File

@ -360,7 +360,9 @@ describe('Post API', function () {
var publishedPost = res.body;
_.has(res.headers, 'x-cache-invalidate').should.equal(true);
res.headers['x-cache-invalidate'].should.eql('/, /page/*, /rss/, /rss/*, /tag/*, /' + publishedPost.posts[0].slug + '/');
res.headers['x-cache-invalidate'].should.eql(
'/, /page/*, /rss/, /rss/*, /tag/*, /author/*, /' + publishedPost.posts[0].slug + '/'
);
publishedPost.should.exist;
publishedPost.posts.should.exist;
@ -762,7 +764,9 @@ describe('Post API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.posts.should.exist;
res.headers['x-cache-invalidate'].should.eql('/, /page/*, /rss/, /rss/*, /tag/*, /' + jsonResponse.posts[0].slug + '/');
res.headers['x-cache-invalidate'].should.eql(
'/, /page/*, /rss/, /rss/*, /tag/*, /author/*, /' + jsonResponse.posts[0].slug + '/'
);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
jsonResponse.posts[0].id.should.eql(deletePostId);
done();