organise headers
This commit is contained in:
parent
2bd532bc20
commit
9c6619f3e0
@ -50,15 +50,7 @@ function handleQuery(req, res){
|
||||
// setup step run
|
||||
var that = this;
|
||||
var start = new Date().getTime();
|
||||
|
||||
// allow cross site post
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "X-Requested-With");
|
||||
|
||||
// set cache headers
|
||||
res.header('Last-Modified', new Date().toUTCString());
|
||||
res.header('Cache-Control', 'no-cache,max-age=3600,must-revalidate, public');
|
||||
|
||||
|
||||
try {
|
||||
if (!_.isString(sql)) throw new Error("You must indicate a sql query");
|
||||
var pg;
|
||||
@ -74,7 +66,6 @@ function handleQuery(req, res){
|
||||
function setDBGetUser(err, data) {
|
||||
if (err) throw err;
|
||||
database = (data == "" || _.isNull(data)) ? database : data;
|
||||
res.header('X-Cache-Channel', database);
|
||||
oAuth.verifyRequest(req, this);
|
||||
},
|
||||
function querySql(err, user_id){
|
||||
@ -109,6 +100,15 @@ function handleQuery(req, res){
|
||||
// configure headers for geojson
|
||||
res.header("Content-Disposition", getContentDisposition(format));
|
||||
|
||||
// allow cross site post
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "X-Requested-With");
|
||||
|
||||
// set cache headers
|
||||
res.header('Last-Modified', new Date().toUTCString());
|
||||
res.header('Cache-Control', 'no-cache,max-age=3600,must-revalidate, public');
|
||||
res.header('X-Cache-Channel', database);
|
||||
|
||||
// return to browser
|
||||
res.send(out);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user