Move functionality that sets cache control header to a middleware
This commit is contained in:
@@ -19,14 +19,20 @@ AnalysesController.prototype.register = function(app) {
|
||||
userMiddleware,
|
||||
this.prepareContext,
|
||||
this.catalog.bind(this),
|
||||
this.setCacheControlHeader(),
|
||||
this.sendResponse()
|
||||
);
|
||||
};
|
||||
|
||||
AnalysesController.prototype.setCacheControlHeader = function () {
|
||||
return function setCacheControlHeaderMiddleware (req, res, next) {
|
||||
res.set('Cache-Control', 'public,max-age=10,must-revalidate');
|
||||
next();
|
||||
};
|
||||
};
|
||||
|
||||
AnalysesController.prototype.sendResponse = function() {
|
||||
return function sendResponseMiddleware (req, res) {
|
||||
res.set('Cache-Control', 'public,max-age=10,must-revalidate');
|
||||
|
||||
res.status(200);
|
||||
|
||||
if (req.query && req.query.callback) {
|
||||
|
||||
Reference in New Issue
Block a user