Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Grpc-Message decoding #117

Merged
merged 2 commits into from
Apr 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 53 additions & 50 deletions test/go/_proto/improbable/grpcweb/test/test.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion test/go/testserver/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions test/proto/improbable/grpcweb/test/test.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ message PingRequest {
NONE = 0;
CODE = 1;
DROP = 2;
CODE_UNICODE = 3;
}

string value = 1;
Expand Down
1 change: 1 addition & 0 deletions test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export namespace PingRequest {
NONE = 0,
CODE = 1,
DROP = 2,
CODE_UNICODE = 3,
}
}

Expand Down
35 changes: 18 additions & 17 deletions test/ts/_proto/improbable/grpcweb/test/test_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

/**
Expand All @@ -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);
};


Expand All @@ -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);
};


Expand All @@ -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);
};


Expand All @@ -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);
};


Expand All @@ -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);
};


Expand All @@ -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);
};


Expand All @@ -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);
};


Expand All @@ -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);
};


Expand Down Expand Up @@ -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);
};


Expand All @@ -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);
};


Expand Down Expand Up @@ -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);
};


Expand All @@ -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);
};


Expand All @@ -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);
};


Expand Down Expand Up @@ -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);
};


Expand Down Expand Up @@ -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);
};


Expand Down Expand Up @@ -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);
};


Expand Down
Loading