diff --git a/services/web/app/src/Features/History/HistoryController.js b/services/web/app/src/Features/History/HistoryController.js index 7fe4223bfe..8da502cbf9 100644 --- a/services/web/app/src/Features/History/HistoryController.js +++ b/services/web/app/src/Features/History/HistoryController.js @@ -13,6 +13,7 @@ const ProjectEntityUpdateHandler = require('../Project/ProjectEntityUpdateHandle const RestoreManager = require('./RestoreManager') const { pipeline } = require('stream') const { prepareZipAttachment } = require('../../infrastructure/Response') +const Features = require('../../infrastructure/Features') module.exports = HistoryController = { selectHistoryApi(req, res, next) { @@ -344,10 +345,20 @@ module.exports = HistoryController = { pass: settings.apis.v1_history.pass, }, json: true, - method: 'post', url, } - request(options, function (err, response, body) { + + if (!Features.hasFeature('saas')) { + const getReq = request({ ...options, method: 'get' }) + getReq.pipe(res) + getReq.on('error', function (err) { + logger.error({ url, err }, 'history API error') + next(err) + }) + return + } + + request({ ...options, method: 'post' }, function (err, response, body) { if (err) { OError.tag(err, 'history API error', { v1ProjectId, diff --git a/services/web/test/unit/src/History/HistoryControllerTests.js b/services/web/test/unit/src/History/HistoryControllerTests.js index 0b3a95fe61..f562943e16 100644 --- a/services/web/test/unit/src/History/HistoryControllerTests.js +++ b/services/web/test/unit/src/History/HistoryControllerTests.js @@ -34,6 +34,10 @@ describe('HistoryController', function () { (this.ProjectEntityUpdateHandler = {}), '../User/UserGetter': (this.UserGetter = {}), './RestoreManager': (this.RestoreManager = {}), + '../../infrastructure/Features': (this.Features = sinon + .stub() + .withArgs('saas') + .returns(true)), }, }) return (this.settings.apis = {