Mounting for "Hide Potentially Dangerous Information Using helmet.hidePoweredBy()"

I’ve included the following code:

var express = require('express');
var helmet = require('helmet');
var app = express();
app.use(helmet());
app.use(helmet.hidePoweredBy());

but it returns “expected [] to include ‘hidePoweredBy’” and “helmet.hidePoweredBy() middleware should be mounted correctly”

I have no idea why this isn’t working. There are no errors in the glitch log.

Here’s my glitch: https://glitch.com/edit/#!/wholesale-entrance

I’ve tried reloading and clearing cache multiple times for both the test page and the glitch page.

You’re not supposed to edit the server.js file. Place the appropriate helmet code at the top of myApp.js and it should work.

1 Like

Thank you. I did as you mentioned and for this code:

let helmet = require('helmet');
app.use(helmet.hidePoweredBy({ setTo: 'PHP 4.2.0' }));

the response header “x-powered-by” is set to PHP 4.2.0 but I get the error
expected ‘Express’ to not equal ‘Express’
on submitting the challenge. I have tried reloading, changing the browser, waiting for sometime before re-trial but the error remains
This is my glitch link:
https://skinny-oboe.glitch.me
Could you please guide?

Thank you

Hey there @EddieCornelious! I have not touched the server.js file, but I keep getting the same error, any chance you can have a look ?