What are the invalid URL case for the URL shortener project

Tell us what’s happening:
I don’t understand what are the test cases for the last item in Back End Development:

If you pass an invalid URL that doesn’t follow the valid http://www.example.com format, the JSON response will contain `{ error: ‘invalid url’ }

I found a regexp for detecting invalid URLs, and it doesn’t work here, so I’m wondering which example is making it fail.

Thank you in advance for your help and happy coding

Your project link(s)

solution: https://url-shortener-jm.herokuapp.com
github: GitHub - JossMilon/url-shortener: 3rd challenge in FCC BackEnd certification - https://www.freecodecamp.org/learn/back-end-development-and-apis/back-end-development-and-apis-projects/request-header-parser-microservice

Your browser information:

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

Challenge: URL Shortener Microservice

Link to the challenge:

Hello!

Your code is correct, it’s just that you should return a 200 instead of the 400.

1 Like

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