c.json returning empty string for undefined values #2338
Unanswered
marcosrjjunior
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Hi @marcosrjjunior ! Thanks for your comment. I think we can follow the By investigating, results are below:
Ideally, |
Beta Was this translation helpful? Give feedback.
1 reply
-
hey @yusukebe thanks for the quick reply. I'm getting "" empty strings for both Nodejs and Bun, that is the issue. I agree, it should thrown an error instead.
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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 offalse
and thec.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?Because of the issues mentioned above I replaced it to use the main response instead.
Beta Was this translation helpful? Give feedback.
All reactions