-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
*: fix 'gogo/protobuf' compatibility issue #5969
Conversation
gyuho
commented
Jul 18, 2016
- Fix Enums are not parsed correctly by v3alpha API when sent as JSON #5942
- Partial fix for watch over grpc-gateway #5865
Partial fix for #5865 because... Currently
wouldn't work, with the server complaining this error in this code https://github.com/coreos/etcd/blob/master/etcdserver/etcdserverpb/rpc.pb.gw.go#L92-L93:
Work-around to make watch work: diff --git a/etcdserver/etcdserverpb/rpc.pb.gw.go b/etcdserver/etcdserverpb/rpc.pb.gw.go
index 4ee9685..1bdd637 100644
--- a/etcdserver/etcdserverpb/rpc.pb.gw.go
+++ b/etcdserver/etcdserverpb/rpc.pb.gw.go
@@ -10,8 +10,11 @@ It translates gRPC into RESTful JSON APIs.
package etcdserverpb
import (
+ "fmt"
"io"
+ "io/ioutil"
"net/http"
+ "strings"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
@@ -86,11 +89,14 @@ func request_Watch_Watch_0(ctx context.Context, marshaler runtime.Marshaler, cli
grpclog.Printf("Failed to start streaming: %v", err)
return nil, metadata, err
}
- dec := marshaler.NewDecoder(req.Body)
+ bts, _ := ioutil.ReadAll(req.Body)
+ fmt.Println(string(bts))
+
+ dec := marshaler.NewDecoder(strings.NewReader(string(bts)))
handleSend := func() error {
var protoReq WatchRequest
err = dec.Decode(&protoReq)
- if err != nil {
+ if err != nil && err != io.EOF {
grpclog.Printf("Failed to decode request: %v", err)
return err
}
and with additional error checking of We need to find some ways to make Will report upstream. |
lgtm |
merging after all greens. thanks. |
Failure not related
Already reported in open issue |
@gyuho Why do we sent a zero length request at the first place? The request you sent should not be a zero length one. I suspect that the jsonpb -> proto thing still not working correctly? |