Skip to content

Commit

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

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

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

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

0 comments on commit a048c07

Please sign in to comment.