Browse Source

vanity headers

pull/4/head
Peter Johnson 10 years ago
parent
commit
a25946cbb6
  1. 6
      index.js
  2. 6
      test/ciao/index.coffee

6
index.js

@ -1,5 +1,6 @@
var app = require('express')();
var pkg = require('./package'),
app = require('express')();
/** ----------------------- middleware ----------------------- **/
@ -10,7 +11,8 @@ app.use(function(req, res, next){
res.header('Access-Control-Allow-Methods', 'GET');
res.header('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.header('Access-Control-Allow-Credentials', true);
res.header('X-Powered-By', 'pelias');
res.header('Server', 'Pelias/'+pkg.version);
res.header('X-Powered-By', 'mapzen');
next();
});

6
test/ciao/index.coffee

@ -14,8 +14,12 @@ response.should.have.header 'Charset','utf8'
#? cache-control header correctly set
response.should.have.header 'Cache-Control','public,max-age=60'
#? server header correctly set
response.should.have.header 'Server'
response.headers.server.should.match /Pelias\/\d{1,2}\.\d{1,2}\.\d{1,2}/
#? vanity header correctly set
response.should.have.header 'X-Powered-By','pelias'
response.should.have.header 'X-Powered-By','mapzen'
#? should respond in json with server info
should.exist json

Loading…
Cancel
Save