2 ms·
What does it matter? What you should do is have the error messages be the same for detecting a length 0 submission and of attempting to parse the empty string
by dalke 13y ago
What does it matter?
What you should do is have the error messages be the same for detecting a length 0 submission and of attempting to parse the empty string as JSON.
You can think of the check for length==0 and length==1 as a sort of optimization (no JSON document can be 1 byte long), rather than a corner case.