URL Shortener Microservice final tests, thank you

Tell us what’s happening:
Can’t pass the final test although response is shown. JSON response { error: ‘Invalid URL’} is shown and same as the example.

Your project link(s)

solution: https://replit.com/@lidoking/boilerplate-project-urlshortener

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: URL Shortener Microservice

Link to the challenge:

Have you verified your casing is correct? Remember a !== A

Yeh. I have tried both, { error: ‘invalid url’ } which is written as a requirement in test (by literally copying and pasting it ), and { error: ‘Invalid URL’ } which is shown in the example.

The problem seems to be that FCC uses ‘ftp:/john-doe.org’ which is supposed to be invalid. Yet, the new URL() function treats it as a valid url and passes it to the dns.lookup() function which checks just the hostname. The new URL() function is probably the culprit.

Added extra layer of checking url (check if url starts with ‘http’ or ‘https’)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.