Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

When response content-length is 0, callback receives undefined as body parameter #414

Closed
cwilbur opened this Issue · 4 comments

2 participants

@cwilbur

When request receives a response where the response body has a content-length of 0, request calls the callback and passes undefined as the body parameter to the callback. I believe that passing the empty string is more correct behavior.

@mikeal
Owner

hrm.... let me think about this one a bit.

@cwilbur

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.

Thanks.

@mikeal
Owner

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.

@ShaunK ShaunK referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@ShaunK ShaunK referenced this issue from a commit in ShaunK/node-soap
Shaun Kiernan Fix for uncaught typeError (Issue 197)
The request library will return an undefined response object if a request response has a 0 length (see request/request#414). This causes node-soap to return an uncaught typeError exception, immediately killing the node process, since it doesn't check if the response object is undefined before trying to retrieve the headers from it.
b2e37b9
@ShaunK ShaunK referenced this issue from a commit in ShaunK/node-soap
Shaun Kiernan Fix for uncaught typeError (Issue 197)
The request library will return an undefined response object if a request response has a 0 length (see request/request#414). This causes node-soap to return an uncaught typeError exception, immediately killing the node process, since it doesn't check if the response object is undefined before trying to retrieve the headers from it.
15cf98f
@ShaunK ShaunK referenced this issue from a commit in ShaunK/node-soap
Shaun Kiernan Fix for uncaught typeError (Issue 197)
The request library will return an undefined response object if a request response has a 0 length (see request/request#414). This causes node-soap to return an uncaught typeError exception, immediately killing the node process, since it doesn't check if the response object is undefined before trying to retrieve the headers from it.
715d32d
@ShaunK ShaunK referenced this issue in vpulim/node-soap
Closed

Fix for uncaught typeError (Issue 197) #198

@ShaunK ShaunK referenced this issue from a commit in ShaunK/node-soap
Shaun Kiernan Fix for uncaught typeError (Issue 197)
The request library will return an undefined response object if a request response has a 0 length (see request/request#414). This causes node-soap to return an uncaught typeError exception, immediately killing the node process, since it doesn't check if the response object is undefined before trying to retrieve the headers from it.
f8e781a
@mikeal
Owner

Is this still an issue?

This is so old I'm closing, if it is actually still an issue just let me know and I'll re-open.

@mikeal mikeal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.