Back End Development and APIs Projects - URL Shortener Microservice

Tell us what’s happening:
I have implemented the URL shortener micro-service and everything is working fine according to the user stories. Still, the invalid URL test case always fails, even though I’m getting the correct results. Can anyone suggest some changes to pass the invalid URL test case?

Your project link(s)

solution: fcc-url-shortener-microservice - Replit

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36

Challenge: Back End Development and APIs Projects - URL Shortener Microservice

Link to the challenge:

If an invalid url is submitted, your app should not respond with a 401 response code. It should still be 200.

401 would not be the correct status code to send for the invalid URL anyway.

But I’m not so sure the test should expect an OK response for the invalid URL. It doesn’t seem unreasonable to send back a 400 (or 422).

422 sounds about right. The instructions, tests, and the demo project should be updated if this is something that is wanted.

Thanks for the info. It worked when I changed the status code to 200 for error ‘invalid url’.