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

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

#1

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.


#2

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.


#3

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