CartoDB-SQL-API/lib/api/middlewares/content.js
Daniel García Aubert 5a96dbb59c Run eslint --fix
2019-12-23 18:19:08 +01:00

17 lines
569 B
JavaScript

'use strict';
const getContentDisposition = require('../../utils/content-disposition');
module.exports = function content () {
return function contentMiddleware (req, res, next) {
const { filename } = res.locals.params;
const { formatter } = req;
const useInline = !req.query.format && !req.body.format && !req.query.filename && !req.body.filename;
res.header('Content-Disposition', getContentDisposition(formatter, filename, useInline));
res.header('Content-Type', formatter.getContentType());
next();
};
};