Tell us what’s happening:
I am trying to compete the URL Shortener Microservice project, for back end development. I can pass all of the test when I try them myself, but when I submit the URL, it won’t pass 2/4 test. These are the two test,
–You can POST a URL to /api/shorturl and get a JSON response with original_url and short_url properties. Here’s an example: { original_url : 'https://freeCodeCamp.org', short_url : 1}
–When you visit /api/shorturl/<short_url> , you will be redirected to the original URL.
I would log out url and name to see if you are not making assumptions about the URL that might not be true. And make sure you are only providing dns.lookup with a hostname (i.e. no paths). It is also worth noting that the invalid URL being used when stripped to just the hostname will pass as a valid URL (you can also look at the tests if that helps).