Moved `/media/thumbnail/ Admin API endpoint to /media/thumbnail/upload

refs  https://github.com/TryGhost/Toolbox/issues/120

- Changed endpoint name as it suits way better to the `/upload` postfix convention we use along with all other endpoints that support file uploads
This commit is contained in:
Naz 2021-11-09 16:15:57 +04:00
parent ced7b858dd
commit 4721b75463
2 changed files with 4 additions and 4 deletions

View File

@ -244,7 +244,7 @@ module.exports = function apiRoutes() {
apiMw.upload.mediaValidation({type: 'media'}),
http(api.media.upload)
);
router.put('/media/thumbnail/',
router.put('/media/thumbnail/upload',
labs.enabledMiddleware('mediaAPI'),
mw.authAdminApi,
apiMw.upload.single('file'),

View File

@ -86,7 +86,7 @@ describe('Media API', function () {
});
});
describe('media/thumbnail/:url', function () {
describe('media/thumbnail/upload', function () {
it('Can update existing thumbnail', async function () {
const res = await request.post(localUtils.API.getApiQuery('media/upload'))
.set('Origin', config.get('url'))
@ -102,7 +102,7 @@ describe('Media API', function () {
media.push(res.body.media[0].url.replace(config.get('url'), ''));
media.push(res.body.media[0].thumbnail_url.replace(config.get('url'), ''));
const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/`))
const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/upload`))
.set('Origin', config.get('url'))
.expect('Content-Type', /json/)
.field('url', res.body.media[0].url)
@ -127,7 +127,7 @@ describe('Media API', function () {
media.push(res.body.media[0].url.replace(config.get('url'), ''));
const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/`))
const thumbnailRes = await request.put(localUtils.API.getApiQuery(`media/thumbnail/upload`))
.set('Origin', config.get('url'))
.expect('Content-Type', /json/)
.field('url', res.body.media[0].url)