-
-
Notifications
You must be signed in to change notification settings - Fork 1k
c.json returning empty string for undefined values #2343
Copy link
Copy link
Open
Labels
Description
Discussed in https://github.com/orgs/honojs/discussions/2338
Originally posted by marcosrjjunior March 11, 2024
I'm mainly creating this ticket to understand a bit more about why this is happening and potentially flag an issue.
One of my functions was returning undefined instead of false and the c.json is forcing the response to be an "" (empty string) instead of throwing an error.

Response: ""
Reading the json implementation here (hopefully that is the correct place).
I noticed that there possibly some extra things going on there:
JSON.stringify(object). Why do we need to run throguh a JSON.stringify before returning?- Re-creating the response
Because of the issues mentioned above I replaced it to use the main response instead.

Reactions are currently unavailable