URL Shortener Microservice -last test - BACK-END-DEVELOPMENT-AND-API-PROJECT

Tell us what’s happening:
Describe your issue in detail here.
Can’t seem to pass the last test of the URL Shortner Microservice project.
Although its doing everything its supposed to do!

I am using validUrl library to check the urls. validUrl.isWebUri()

Your project link(s)

solution: ----https://usms-ojasthakur.herokuapp.com----

githubLink: GitHub - ojasthakur/FCC-url-shortner-microservice

Your browser information:

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

Challenge: URL Shortener Microservice

Link to the challenge:

Test your api. With a POST, testing it with a tool like Postman will make it easier - that (or something like that) is a great tool for API work.

You can see what the test is doing. If you open up the browser dev tools, you can open the network tab and see what test is failing.

I can also see the payload it is using to test:

And I can see your response:

Screen Shot 2022-03-17 at 11.58.20 AM

My first question would be: Does your response match the requested response? And important part of dev work is paying attention to small details. Computers aren’t really got at, “Well, that’s close enough, I think he know what he was thinking.”

Thanks a lot for the idea of using dev tools. The whole thing was already working fine as i had already tested. Turns out the test expected a status code of 200 while i was returning 401 while dealing with the invalid url. Such a pain, but atleast i now know 10 ways to test a url :smiley:

I guess that too. I was trying to point out that the casing on the response does not match what is expected. Perhaps the test allows for that, but in general, bugs like that can cause nightmares. I saw a commercial app in production fail for that something similar - and the unit tests weren’t written well enough to catch it. You have to pay very close attention to things like that.

1 Like