Back End Development and APIs Projects - URL Shortener Microservice

When I use the project and start up the server, everything works like it should, but when I run the tests, a bunch of errors are thrown. Can someone tell me what might be wrong here?

githubLink: https://github.com/jgarner9/backend_dev_course/tree/main/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/121.0.0.0 Safari/537.36

Challenge Information:

Back End Development and APIs Projects - URL Shortener Microservice

1 Like

The pathname property is not giving you what you want. If you just want the full URL you can use the href property (or use the body payload string).

new URL('https://3000-jgarner9-boilerplatepro-xqjqqqsyo9e.ws-eu108.gitpod.io/?v=1708264768053').pathname
'/'

Payload: https://3000-jgarner9-boilerplatepro-xqjqqqsyo9e.ws-eu108.gitpod.io/?v=1708264768053

Response:

{
  "original_url": "https://3000-jgarner9-boilerplatepro-xqjqqqsyo9e.ws-eu108.gitpod.io/",
  "shorturl": 1
}

I don’t think this will fix much but it is a start.


Try to debug the code, if the tests are crashing your code something is wrong. Submit the code and read the errors, look in the console both on the backend and browser, and use the network tab in the browser to look at the request/response.