Backend should not return 404 errors when no URLs are found
halfwhole opened this issue · 0 comments
Describe the bug
When querying /api/user/url
, if zero URLs match the query, the backend responds with a 404 error with body Urls not found
. This should not be the response returned.
When the frontend tries to parse Urls not found
as JSON, it results in an uncaught error:
This breaks the user page whenever the user makes queries that return 0 URLs.
Expected behaviour
Backend should return 200 with body {"urls":[],"count":0}
- this is the behaviour in our latest release v1.69.0
On the frontend, when the user has no links, we should see this:
When the user has links and makes a query returning no results, we should see this:
Actual behaviour
Backend returns 404 error with body Urls not found
- this is the current behaviour in develop
On the frontend, when the user has no links:
When the user has links and makes a query returning no results, the page simply does not update at all.
Additional thoughts
- Having backend integration tests could be useful in helping to catch regressions like these
- E2E tests should test for having no links or queries returning no results