I made a simple app that stores the urls in a json file and it does work with any webpage I enter (only now do I see a lot of you used mongo to store them). But when I try the code, I get this wrong:
“3. When you visit /api/shorturl/<short_url>, you will be redirected to the original URL.”
And when I went to see what urls were being entered in the test I got this:
How do I work around this? How do I deal with that kind of url? Since it gets stored, the program does accept it, but it does not seem to “give it back” because of the name. I understand I should return freeCodeCamp’s localhost and not mine, but I don’t know how to fix it.
You’ll have to contact the FCC support if you feel everything is right because they had to mock the browser’s fetch API to get around some CORS issues, and that ended up breaking some tests for their legacy backend projects.
I’m working on the URL Shortener Microservice project and I found something strange while debugging the FCC tests.
My app correctly stores the URLs, but the first automated test still fails. After adding traces, I noticed that the test runner creates the first short URL with a POST request, but never follows up with the GET request to check the redirect. The second attempt works normally.
I’m having an issue with the URL Shortener project tests in the Backend Development and APIs certification.
From my debugging traces, it looks like the automated test sends a POST request to create the shortened URL, but during the first test case it never performs the corresponding GET request to verify the redirect. Because of that, the first attempt fails even though the URL is correctly saved.
just keep in mind, the course is archived. If someone volunteers a fix, and then it breaks again for some other reason, one should not expect any fixes.