Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
When response content-length is 0, callback receives undefined as body parameter #414
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
Upon half an hour's reflection, I think you can make a solid case either for undefined or the empty string. But it surprised me because I was expecting an empty string, and I wasn't sure it was intentional behavior. If you do decide that the current behavior is the correct one, a sentence in the docs to that effect wouldn't go amiss.
so, there is a change coming up for 3.0. streams2 changes some internal stream semantics we rely on. because of this change we're going to move to an API where "if you send a callback we'll buffer the body", where currently if you stream we'll call the callback just without the buffered body. at that point, having an empty string seems much more appropriate than undefined.