mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Removed cache invalidation header when adding label through Amdin API
no issue - Adding labels doesn't cause any content to invalidate, similarly to adding members. Unlike it's caunterpart - tags, there is no dependent "frontend" content that would become invalid
This commit is contained in:
parent
5dcd856088
commit
59c773fb04
2 changed files with 52 additions and 3 deletions
|
@ -64,9 +64,7 @@ module.exports = {
|
|||
|
||||
add: {
|
||||
statusCode: 201,
|
||||
headers: {
|
||||
cacheInvalidate: true
|
||||
},
|
||||
headers: {},
|
||||
options: [
|
||||
'include'
|
||||
],
|
||||
|
|
51
test/api-acceptance/admin/labels_spec.js
Normal file
51
test/api-acceptance/admin/labels_spec.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
const path = require('path');
|
||||
const should = require('should');
|
||||
const supertest = require('supertest');
|
||||
const sinon = require('sinon');
|
||||
const testUtils = require('../../utils');
|
||||
const localUtils = require('../../regression/api/canary/admin/utils');
|
||||
const config = require('../../../core/shared/config');
|
||||
|
||||
const ghost = testUtils.startGhost;
|
||||
|
||||
let request;
|
||||
|
||||
describe('Labels API', function () {
|
||||
after(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
before(function () {
|
||||
return ghost()
|
||||
.then(function () {
|
||||
request = supertest.agent(config.get('url'));
|
||||
})
|
||||
.then(function () {
|
||||
return localUtils.doAuth(request);
|
||||
});
|
||||
});
|
||||
|
||||
it('Can add', function () {
|
||||
const label = {
|
||||
name: 'test'
|
||||
};
|
||||
|
||||
return request
|
||||
.post(localUtils.API.getApiQuery(`labels/`))
|
||||
.send({labels: [label]})
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(201)
|
||||
.then((res) => {
|
||||
should.not.exist(res.headers['x-cache-invalidate']);
|
||||
const jsonResponse = res.body;
|
||||
should.exist(jsonResponse);
|
||||
should.exist(jsonResponse.labels);
|
||||
|
||||
jsonResponse.labels.should.have.length(1);
|
||||
jsonResponse.labels[0].name.should.equal(label.name);
|
||||
jsonResponse.labels[0].slug.should.equal(label.name);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue