I tested the code on my machine and works perfectly, I get the JSON response the way is in the example, bad URLs are rejected, the code update in the case is provided the same url, I don’t know what I need to do. I’ll appreciate any help.
I notice one thing, I caught the URLs that the tests are sending to my site, and two URLs are for my Replit link like this: https://urlshortener.luizfernandorg.repl.co/, but that URL return as an invalid link, may this is causing the failing tests
I"m getting from the tests those 3 URLs, I tested those first two, I can access the URLs and those are valid they give access to it, and the FTP URL is an invalid URL, I don’t understand, are all three supposed to fail to validate the tests?
I updated the Regular Expression, but I don’t know why dns.lookup don’t accept those links above, I can access the URLs without a problem, during the test I notice that dns.lookup don’t accept URLs with “http|https|ftp”, etc. only everything after “://”
I published on Heroku, this is the link https://boiling-spire-01138.herokuapp.com/, but will work for a few moments because Mongo Atlas limitation, I don’t have the application ip
When I submit your Heroku app and look at the network tab in the browser I see CORS blocking.
We can’t see your code on Heroku so if you need help link to your repository with the code, or keep using replit.
The FTP URL is the one that is supposed to fail validation. Technically, it’s the only invalid URL that is tested against so just checking the protocol would be enough.
You can get the protocol and hostname using the URL constructor.
new URL('https://www.freecodecamp.org/test').protocol
'https:'
new URL('https://www.freecodecamp.org/test').hostname
'www.freecodecamp.org'
The dns method takes a hostname which is just the domain name and top-level domain, e.g. for this URL https://www.freecodecamp.org/test the hostname is freecodecamp.org.