Skip to content

Commit

Permalink
Allow null response
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh authored and stanley-cheung committed Jan 23, 2021
1 parent f960b8f commit 201c689
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion javascript/net/grpc/web/grpcwebclientbase.js
Expand Up @@ -227,10 +227,12 @@ class GrpcWebClientBase {
* @param {boolean} useUnaryResponse
*/
static setCallback_(stream, callback, useUnaryResponse) {
var isResponseReceived = false;
var responseReceived = null;
var errorEmitted = false;

stream.on('data', function(response) {
isResponseReceived = true;
responseReceived = response;
});

Expand Down Expand Up @@ -264,7 +266,7 @@ class GrpcWebClientBase {

stream.on('end', function() {
if (!errorEmitted) {
if (responseReceived == null) {
if (!isResponseReceived) {
callback({
code: StatusCode.UNKNOWN,
message: 'Incomplete response',
Expand Down

0 comments on commit 201c689

Please sign in to comment.