diff --git a/src/server.ts b/src/server.ts index 6753f79..751e214 100644 --- a/src/server.ts +++ b/src/server.ts @@ -15,6 +15,7 @@ import { Options } from './types'; export default function createServer(opts : Options) : express.Application { const app = express(); + app.disable('x-powered-by'); if (process.env.NODE_ENV !== 'test') { app.use(logging); } diff --git a/tests/server.test.ts b/tests/server.test.ts index b4eb395..edbfed4 100644 --- a/tests/server.test.ts +++ b/tests/server.test.ts @@ -20,6 +20,21 @@ describe('Server', function () { }); }); + it('Should nave no x-powered-by header', function (done) { + runServer({ + allowed_ips: [], + basicAuth: [], + dirList: false, + serveDir: 'site/', + opbeat: false, + open: false + }, '/index.html', function (response : any) { + expect(response.status).to.equal(200); + expect(response.headers.get('x-powered-by')).to.equal(null); + done(); + }); + }); + describe('index route', function () { const body = fs.readFileSync(path.join(__dirname, '..', 'site', 'index.html')).toString();