Skip to content

Commit

Permalink
Implement grpc-gateway Delimited interface
Browse files Browse the repository at this point in the history
Implement the Delimited interface for the gogo/protobuf JSONPb marshaller.

Fixes #20925
  • Loading branch information
johanbrandhorst committed Dec 22, 2017
1 parent 52bd510 commit 295270c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/util/protoutil/jsonpb_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,8 @@ func (j *JSONPb) NewEncoder(w io.Writer) gwruntime.Encoder {
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
})
}

// Delimiter implements gwruntime.Delimited.
func (*JSONPb) Delimiter() []byte {
return []byte("\n")
}
5 changes: 5 additions & 0 deletions pkg/util/protoutil/marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ func (e *protoEncoder) Encode(v interface{}) error {
}
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
}

// Delimiter implements gwruntime.Delimited.
func (*ProtoPb) Delimiter() []byte {
return nil
}

0 comments on commit 295270c

Please sign in to comment.