I have been having issues trying to pass this test on replit. I saw comments of others somehow passing the tests using glitch so I decided to give it a shot.
Issue in detail here.
I actually thought the problems were due to cookies getting blocked on my browser. So I disabled the cookies, refreshed and ran the tests but still did not fix the problem (I will still advice you to make sure your cookies are disabled from blocking the site. Just to be certain the problems are not coming from that end).
This is the error I keep getting:
// running tests
helmet.hidePoweredBy() middleware should be mounted correctly
// tests completed
This is my code so far
const helmet = require('helmet'); const express = require('express'); const app = express(); app.use(helmet.hidePoweredBy());
Your browser information:
User Agent is: Microsoft Edge
Version 105.0.1343.33 (Official build) (64-bit)
This is the fix that helped me pass the tests.
NB: This was as the time of making this post.
I imported the repo to my glitch and then typed this code in myApp.js
const helmet = require("helmet"); app.use(helmet.hidePoweredBy());
Next, I refreshed my imported project (from github) on my glitch.com account, and copied the live url of the project, pasted on the test-link on freecodecamp. Then it passed.
Challenge: Information Security with HelmetJS - Hide Potentially Dangerous Information Using helmet.hidePoweredBy()
Link to the challenge: