diff --git a/test/go/_proto/improbable/grpcweb/test/test.pb.go b/test/go/_proto/improbable/grpcweb/test/test.pb.go index 04ea7be7..c9ceb6cf 100644 --- a/test/go/_proto/improbable/grpcweb/test/test.pb.go +++ b/test/go/_proto/improbable/grpcweb/test/test.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: improbable/grpcweb/test/test.proto -// DO NOT EDIT! /* Package improbable_grpcweb_test is a generated protocol buffer package. @@ -42,20 +41,23 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type PingRequest_FailureType int32 const ( - PingRequest_NONE PingRequest_FailureType = 0 - PingRequest_CODE PingRequest_FailureType = 1 - PingRequest_DROP PingRequest_FailureType = 2 + PingRequest_NONE PingRequest_FailureType = 0 + PingRequest_CODE PingRequest_FailureType = 1 + PingRequest_DROP PingRequest_FailureType = 2 + PingRequest_CODE_UNICODE PingRequest_FailureType = 3 ) var PingRequest_FailureType_name = map[int32]string{ 0: "NONE", 1: "CODE", 2: "DROP", + 3: "CODE_UNICODE", } var PingRequest_FailureType_value = map[string]int32{ - "NONE": 0, - "CODE": 1, - "DROP": 2, + "NONE": 0, + "CODE": 1, + "DROP": 2, + "CODE_UNICODE": 3, } func (x PingRequest_FailureType) String() string { @@ -777,46 +779,47 @@ var _FailService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("improbable/grpcweb/test/test.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 652 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0x8e, 0xdb, 0xb4, 0x4d, 0x27, 0x4d, 0xdf, 0x74, 0x5f, 0x28, 0x26, 0x5c, 0x82, 0xa1, 0x52, - 0xa4, 0x4a, 0x4e, 0x49, 0xef, 0x1c, 0x48, 0xc3, 0x87, 0xe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, - 0xaa, 0xbb, 0x3b, 0x86, 0xfc, 0x15, 0x36, 0x6e, 0x68, 0x83, 0x3c, 0x9b, 0x9e, 0x7e, 0x8a, 0x20, - 0x1b, 0x9d, 0xbf, 0x09, 0x29, 0x58, 0xec, 0x9c, 0x9b, 0x1f, 0x60, 0xd1, 0xe8, 0x47, 0xa8, 0x1e, - 0xb2, 0xa4, 0x77, 0x49, 0x85, 0x0c, 0x92, 0x79, 0x2f, 0xdd, 0x60, 0x59, 0x37, 0xbf, 0xfb, 0x33, - 0x00, 0x00, 0xff, 0xff, 0xae, 0x5a, 0x23, 0xd6, 0x3e, 0x07, 0x00, 0x00, + // 662 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x9b, 0xb4, 0x4d, 0x27, 0x49, 0x49, 0x17, 0x28, 0x26, 0x5c, 0x82, 0xa1, 0x52, 0x24, + 0x24, 0xa7, 0xa4, 0x67, 0x38, 0x90, 0x06, 0xa8, 0x68, 0xd3, 0xca, 0x4d, 0x39, 0xf0, 0x23, 0xcb, + 0xb1, 0x27, 0xe9, 0xaa, 0x8e, 0xd7, 0xac, 0xd7, 0xa5, 0x95, 0x78, 0x22, 0x5e, 0x8d, 0x2b, 0x0f, + 0x80, 0x76, 0xd7, 0xa6, 0x41, 0x6d, 0x4a, 0x40, 0xb9, 0x58, 0x3b, 0xdf, 0xfc, 0xec, 0xec, 0x37, + 0xf3, 0x19, 0x2c, 0x3a, 0x89, 0x39, 0x1b, 0x7a, 0xc3, 0x10, 0xdb, 0x63, 0x1e, 0xfb, 0x5f, 0x71, + 0xd8, 0x16, 0x98, 0x08, 0xf5, 0xb1, 0x63, 0xce, 0x04, 0x23, 0x0f, 0xae, 0x62, 0xec, 0x2c, 0xc6, + 0x96, 0xee, 0xc6, 0xa3, 0x31, 0x63, 0xe3, 0x10, 0xdb, 0x2a, 0x6c, 0x98, 0x8e, 0xda, 0x38, 0x89, + 0xc5, 0xa5, 0xce, 0xb2, 0xbe, 0x17, 0xa1, 0x72, 0x44, 0xa3, 0xb1, 0x83, 0x5f, 0x52, 0x4c, 0x04, + 0xb9, 0x07, 0xcb, 0xe7, 0x5e, 0x98, 0xa2, 0x69, 0x34, 0x8d, 0xd6, 0x9a, 0xa3, 0x0d, 0xb2, 0x05, + 0xeb, 0x1c, 0x93, 0x98, 0x45, 0x09, 0xba, 0x3e, 0x4b, 0x23, 0x61, 0x2e, 0x35, 0x8d, 0xd6, 0xb2, + 0x53, 0xcb, 0xd1, 0xae, 0x04, 0x89, 0x0d, 0x77, 0x91, 0x73, 0xc6, 0x5d, 0x9f, 0x05, 0xe8, 0x72, + 0x14, 0x29, 0x8f, 0x30, 0x30, 0x8b, 0x4d, 0xa3, 0x55, 0x73, 0x36, 0x94, 0xab, 0xcb, 0x02, 0x74, + 0x32, 0x07, 0x39, 0x86, 0xea, 0xc8, 0xa3, 0x61, 0xca, 0xd1, 0x15, 0x97, 0x31, 0x9a, 0xa5, 0xa6, + 0xd1, 0x5a, 0xef, 0x6c, 0xdb, 0x33, 0x5e, 0x62, 0x4f, 0x35, 0x6a, 0xbf, 0xd6, 0x89, 0x83, 0xcb, + 0x18, 0x9d, 0xca, 0xe8, 0xca, 0x90, 0xbd, 0xfa, 0xa7, 0xe8, 0x9f, 0xb9, 0x13, 0x14, 0x5e, 0xe0, + 0x09, 0xcf, 0x5c, 0x6e, 0x1a, 0xad, 0xb2, 0x53, 0x53, 0xe8, 0x41, 0x06, 0x92, 0xc7, 0x50, 0x4d, + 0x30, 0x0a, 0xdc, 0x53, 0xf4, 0x02, 0xe4, 0x89, 0xb9, 0xa2, 0x82, 0x2a, 0x12, 0x7b, 0xab, 0x21, + 0xf2, 0x04, 0x6a, 0x2a, 0x44, 0x70, 0x8f, 0x86, 0x32, 0x66, 0x55, 0xc5, 0xa8, 0xbc, 0x41, 0x86, + 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 0x87, 0x6c, 0xda, 0x5a, 0x56, 0x76, 0x2e, 0x2b, 0x5b, 0xe1, + 0x8d, 0xad, 0xbf, 0x6c, 0xaf, 0xbe, 0xd3, 0x2a, 0x90, 0x13, 0x28, 0x49, 0x84, 0x3c, 0x9d, 0x67, + 0xdd, 0xe7, 0x2f, 0xfb, 0x2e, 0x6b, 0x52, 0x8a, 0x6d, 0xce, 0xda, 0x33, 0x9e, 0x62, 0x15, 0xc8, + 0x47, 0x28, 0xcb, 0xc0, 0x7d, 0x9a, 0x88, 0x05, 0xf7, 0xb9, 0x6d, 0x10, 0x4f, 0x6f, 0xf3, 0x11, + 0x8b, 0xc6, 0xaf, 0x68, 0x40, 0x17, 0x7c, 0x41, 0xcb, 0xd8, 0x36, 0xc8, 0x67, 0x00, 0x89, 0xea, + 0xa9, 0x2f, 0xfc, 0x02, 0x32, 0x80, 0x52, 0xcf, 0x3f, 0x65, 0xb7, 0x14, 0x9e, 0x92, 0x5b, 0x63, + 0xae, 0x28, 0xab, 0xd0, 0xf9, 0x61, 0xc0, 0x1d, 0xb9, 0x76, 0x27, 0x82, 0x86, 0xf9, 0xea, 0x7d, + 0x80, 0xf5, 0x3f, 0xe5, 0x44, 0xec, 0x99, 0xd5, 0x6e, 0xd4, 0xdd, 0x2d, 0x43, 0xfe, 0x06, 0x1b, + 0xd7, 0xb4, 0x41, 0x9e, 0xcf, 0x2e, 0x3f, 0x43, 0x90, 0x8d, 0xce, 0xbf, 0xa4, 0xe4, 0x2c, 0x76, + 0xce, 0xf4, 0x2f, 0x31, 0x7f, 0xe8, 0x27, 0xa8, 0xf4, 0x59, 0xd4, 0xbb, 0xa0, 0x89, 0xf0, 0xa2, + 0x45, 0x2f, 0xdd, 0x70, 0x45, 0x3d, 0x7e, 0xe7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xef, + 0x91, 0x01, 0x50, 0x07, 0x00, 0x00, } diff --git a/test/go/testserver/testserver.go b/test/go/testserver/testserver.go index e948d01d..7a0d4db1 100644 --- a/test/go/testserver/testserver.go +++ b/test/go/testserver/testserver.go @@ -154,7 +154,11 @@ func (s *testSrv) PingError(ctx context.Context, ping *testproto.PingRequest) (* if ping.GetSendTrailers() { grpc.SetTrailer(ctx, metadata.Pairs("TrailerTestKey1", "ServerValue1", "TrailerTestKey2", "ServerValue2")) } - return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "Intentionally returning error for PingError") + if ping.FailureType == testproto.PingRequest_CODE { + return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "Intentionally returning error for PingError") + } else { + return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "💣") + } } func (s *testSrv) ContinueStream(ctx context.Context, req *testproto.ContinueStreamRequest) (*google_protobuf.Empty, error) { diff --git a/test/proto/improbable/grpcweb/test/test.proto b/test/proto/improbable/grpcweb/test/test.proto index 2fab08de..693fb568 100644 --- a/test/proto/improbable/grpcweb/test/test.proto +++ b/test/proto/improbable/grpcweb/test/test.proto @@ -9,6 +9,7 @@ message PingRequest { NONE = 0; CODE = 1; DROP = 2; + CODE_UNICODE = 3; } string value = 1; diff --git a/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts b/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts index fe03de60..2d3619f9 100644 --- a/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts +++ b/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts @@ -55,6 +55,7 @@ export namespace PingRequest { NONE = 0, CODE = 1, DROP = 2, + CODE_UNICODE = 3, } } diff --git a/test/ts/_proto/improbable/grpcweb/test/test_pb.js b/test/ts/_proto/improbable/grpcweb/test/test_pb.js index e47ce59b..1dd25187 100644 --- a/test/ts/_proto/improbable/grpcweb/test/test_pb.js +++ b/test/ts/_proto/improbable/grpcweb/test/test_pb.js @@ -236,7 +236,8 @@ proto.improbable.grpcweb.test.PingRequest.serializeBinaryToWriter = function(mes proto.improbable.grpcweb.test.PingRequest.FailureType = { NONE: 0, CODE: 1, - DROP: 2 + DROP: 2, + CODE_UNICODE: 3 }; /** @@ -250,7 +251,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getValue = function() { /** @param {string} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setValue = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -265,7 +266,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getResponseCount = function( /** @param {number} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setResponseCount = function(value) { - jspb.Message.setField(this, 2, value); + jspb.Message.setProto3IntField(this, 2, value); }; @@ -280,7 +281,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getErrorCodeReturned = funct /** @param {number} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setErrorCodeReturned = function(value) { - jspb.Message.setField(this, 3, value); + jspb.Message.setProto3IntField(this, 3, value); }; @@ -295,7 +296,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getFailureType = function() /** @param {!proto.improbable.grpcweb.test.PingRequest.FailureType} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setFailureType = function(value) { - jspb.Message.setField(this, 4, value); + jspb.Message.setProto3EnumField(this, 4, value); }; @@ -312,7 +313,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getCheckMetadata = function( /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setCheckMetadata = function(value) { - jspb.Message.setField(this, 5, value); + jspb.Message.setProto3BooleanField(this, 5, value); }; @@ -329,7 +330,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getSendHeaders = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setSendHeaders = function(value) { - jspb.Message.setField(this, 6, value); + jspb.Message.setProto3BooleanField(this, 6, value); }; @@ -346,7 +347,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getSendTrailers = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setSendTrailers = function(value) { - jspb.Message.setField(this, 7, value); + jspb.Message.setProto3BooleanField(this, 7, value); }; @@ -361,7 +362,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getStreamIdentifier = functi /** @param {string} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setField(this, 8, value); + jspb.Message.setProto3StringField(this, 8, value); }; @@ -515,7 +516,7 @@ proto.improbable.grpcweb.test.PingResponse.prototype.getValue = function() { /** @param {string} value */ proto.improbable.grpcweb.test.PingResponse.prototype.setValue = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -530,7 +531,7 @@ proto.improbable.grpcweb.test.PingResponse.prototype.getCounter = function() { /** @param {number} value */ proto.improbable.grpcweb.test.PingResponse.prototype.setCounter = function(value) { - jspb.Message.setField(this, 2, value); + jspb.Message.setProto3IntField(this, 2, value); }; @@ -696,7 +697,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getText = function() { /** @param {string} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setText = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -713,7 +714,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getSendHeaders = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setSendHeaders = function(value) { - jspb.Message.setField(this, 2, value); + jspb.Message.setProto3BooleanField(this, 2, value); }; @@ -730,7 +731,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getSendTrailers = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setSendTrailers = function(value) { - jspb.Message.setField(this, 3, value); + jspb.Message.setProto3BooleanField(this, 3, value); }; @@ -872,7 +873,7 @@ proto.improbable.grpcweb.test.ContinueStreamRequest.prototype.getStreamIdentifie /** @param {string} value */ proto.improbable.grpcweb.test.ContinueStreamRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -1014,7 +1015,7 @@ proto.improbable.grpcweb.test.CheckStreamClosedRequest.prototype.getStreamIdenti /** @param {string} value */ proto.improbable.grpcweb.test.CheckStreamClosedRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -1158,7 +1159,7 @@ proto.improbable.grpcweb.test.CheckStreamClosedResponse.prototype.getClosed = fu /** @param {boolean} value */ proto.improbable.grpcweb.test.CheckStreamClosedResponse.prototype.setClosed = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3BooleanField(this, 1, value); }; diff --git a/test/ts/src/client.spec.ts b/test/ts/src/client.spec.ts index aa8eebac..6afce949 100644 --- a/test/ts/src/client.spec.ts +++ b/test/ts/src/client.spec.ts @@ -111,7 +111,7 @@ describe(`client`, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -158,7 +158,7 @@ describe(`client`, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -203,7 +203,7 @@ describe(`client`, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -254,7 +254,7 @@ describe(`client`, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -299,7 +299,7 @@ describe(`client`, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -351,6 +351,44 @@ describe(`client`, () => { }); }); + headerTrailerCombos((withHeaders, withTrailers) => { + it(`should report status code in Unicode for error with headers + trailers`, (done) => { + let didGetOnHeaders = false; + let didGetOnMessage = false; + + const ping = new PingRequest(); + ping.setFailureType(PingRequest.FailureType.CODE_UNICODE); + ping.setErrorCodeReturned(12); + ping.setSendHeaders(withHeaders); + ping.setSendTrailers(withTrailers); + + const client = grpc.client(TestService.PingError, { + debug: DEBUG, + transport: transport, + host: testHostUrl, + }); + client.onHeaders((headers: grpc.Metadata) => { + DEBUG && debug("headers", headers); + didGetOnHeaders = true; + }); + client.onMessage((message: Empty) => { + didGetOnMessage = true; + }); + client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { + DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); + assert.deepEqual(trailers.get("grpc-status"), ["12"]); + assert.deepEqual(trailers.get("grpc-message"), [encodeURIComponent("💣")]); + assert.strictEqual(status, grpc.Code.Unimplemented); + assert.strictEqual(statusMessage, "💣"); + assert.ok(didGetOnHeaders); + assert.ok(!didGetOnMessage); + done(); + }); + client.start(); + client.send(ping); + }); + }); + if (!process.env.DISABLE_CORS_TESTS) { it(`should report failure for a CORS failure`, (done) => { let didGetOnHeaders = false; diff --git a/test/ts/src/invoke.spec.ts b/test/ts/src/invoke.spec.ts index eff7a32c..123f7764 100644 --- a/test/ts/src/invoke.spec.ts +++ b/test/ts/src/invoke.spec.ts @@ -76,7 +76,7 @@ describe("invoke", () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -123,7 +123,7 @@ describe("invoke", () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -167,7 +167,7 @@ describe("invoke", () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -217,7 +217,7 @@ describe("invoke", () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -261,7 +261,7 @@ describe("invoke", () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); diff --git a/test/ts/src/unary.spec.ts b/test/ts/src/unary.spec.ts index 43a5b6d8..c9e36f6f 100644 --- a/test/ts/src/unary.spec.ts +++ b/test/ts/src/unary.spec.ts @@ -67,7 +67,7 @@ describe(`unary`, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); @@ -108,7 +108,7 @@ describe(`unary`, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); @@ -143,7 +143,7 @@ describe(`unary`, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); diff --git a/ts/src/client.ts b/ts/src/client.ts index 587889e1..f0632ec4 100644 --- a/ts/src/client.ts +++ b/ts/src/client.ts @@ -101,7 +101,14 @@ class GrpcClient