Skip to content
This repository was archived by the owner on Apr 3, 2023. It is now read-only.

Error 404 on route GET users/{id} when not logged in #30

@TeddyRoncin

Description

@TeddyRoncin

Description

When you make a request on route GET users/{id}, API returns an error 404 (Resource not found), even if user was found. It should return an error 401 (Unauthorized), both in the case the user does not exist and in the case it does exist
image

There is a problem that occurs in the same situation when doing tests :
image
However, the problem is not the same, this is an error, and the problem I described earlier was a bug

Investigation of the issue

I tried changing function supports of class App\DataProvider\UserDataVisibilityItemDataProvider to make it also check for login : $checkLogin = $this->security->getUser() != null;.
This fixes the issue in tests :
image
This fix does not change anything in a normal call. It seems like by changing this function, the getItem method of the same class is not called anymore (which is the behaviour we would expect). But APIPlateform still returns a 404 code instead of a 401 code

Metadata

Metadata

Labels

Bug 🐛Something isn't working or don't work correctly

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions