Skip to content

Commit

Permalink
Merge branch 'master' into delta
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Mar 30, 2024
2 parents a826f3a + a9e11df commit 151d7a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions decode_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func (d *JSONStreamCommandDecoder) Decode() (*Command, int, error) {
if err != nil {
if err == io.EOF && len(cmdBytes) > 0 {
var c Command
_, err = json.Parse(cmdBytes, &c, 0)
if err != nil {
return nil, 0, err
_, parseErr := json.Parse(cmdBytes, &c, 0)
if parseErr != nil {
return nil, 0, parseErr
}
return &c, len(cmdBytes), err
}
Expand Down
10 changes: 7 additions & 3 deletions decode_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ func testDecodingFrame(tb testing.TB, frame []byte, protoType Type) {
require.Equal(tb, 10037, size)
}
_, size, err = dec.Decode()
require.NoError(tb, err)
if protoType == TypeProtobuf {
require.Equal(tb, 10018, size)
} else {
require.Equal(tb, 10036, size)
}
_, _, err = dec.Decode()
require.ErrorIs(tb, err, io.EOF)
if err != nil {
require.ErrorIs(tb, err, io.EOF)
} else {
_, _, err = dec.Decode()
require.ErrorIs(tb, err, io.EOF)
}

PutStreamCommandDecoder(protoType, dec)
}

0 comments on commit 151d7a9

Please sign in to comment.