You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the email received by the backend is an empty string, the code should return None.
Backend
@app.get("/api/v1/users/email/{user_email}",)defread_user_by_email(email: str) ->UserPublic|None:
""" Get a specific user by email. """ifemail!="":
print("Not none")
returnUserPublic(name="User", age=10)
print("None")
returnNone
Output:
None
However, the frontend receives {} even when the string None is printed on the backend.
Hi @SavioR0! Yep, aware this is an issue, I was waiting until someone brings it up. The reason is the object is used to verify if the response was successful or not to narrow down the types. We'll need to modify this to include an alternative approach so we can preserve the original response data. Is this a blocker for you or an inconvenience? Thank you for reporting!
Below is the link to the minimum code to reproduce the issue:
https://github.com/SavioR0/NoneBug
When the email received by the backend is an empty string, the code should return None.
Backend
Output:
However, the frontend receives {} even when the string None is printed on the backend.
Frontend
Output:
The text was updated successfully, but these errors were encountered: