mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Changed response structure for /images
refs #10438 - To make response structure future proof and conform to the rest of API responses /images* now returns an object with url property instead of plain url string
This commit is contained in:
parent
187636193b
commit
55289d04c8
2 changed files with 12 additions and 10 deletions
|
@ -2,9 +2,11 @@ const debug = require('ghost-ignition').debug('api:v2:utils:serializers:output:u
|
|||
const mapper = require('./utils/mapper');
|
||||
|
||||
module.exports = {
|
||||
image(models, apiConfig, frame) {
|
||||
image(path, apiConfig, frame) {
|
||||
debug('image');
|
||||
|
||||
return frame.response = mapper.mapImage(models);
|
||||
return frame.response = {
|
||||
url: mapper.mapImage(path)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -39,9 +39,9 @@ describe('Upload API', function () {
|
|||
return done(err);
|
||||
}
|
||||
|
||||
res.body.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/ghost-logo.png`));
|
||||
res.body.url.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/ghost-logo.png`));
|
||||
|
||||
images.push(res.body.replace(config.get('url'), ''));
|
||||
images.push(res.body.url.replace(config.get('url'), ''));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -57,9 +57,9 @@ describe('Upload API', function () {
|
|||
return done(err);
|
||||
}
|
||||
|
||||
res.body.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/ghosticon.jpg`));
|
||||
res.body.url.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/ghosticon.jpg`));
|
||||
|
||||
images.push(res.body.replace(config.get('url'), ''));
|
||||
images.push(res.body.url.replace(config.get('url'), ''));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -75,9 +75,9 @@ describe('Upload API', function () {
|
|||
return done(err);
|
||||
}
|
||||
|
||||
res.body.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/loadingcat.gif`));
|
||||
res.body.url.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/loadingcat.gif`));
|
||||
|
||||
images.push(res.body.replace(config.get('url'), ''));
|
||||
images.push(res.body.url.replace(config.get('url'), ''));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -93,9 +93,9 @@ describe('Upload API', function () {
|
|||
return done(err);
|
||||
}
|
||||
|
||||
res.body.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/loadingcat_square.gif`));
|
||||
res.body.url.should.match(new RegExp(`${config.get('url')}/content/images/\\d+/\\d+/loadingcat_square.gif`));
|
||||
|
||||
images.push(res.body.replace(config.get('url'), ''));
|
||||
images.push(res.body.url.replace(config.get('url'), ''));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue