apache/dubbo-go-hessian2

nil encoding not correct

Opened this issue · 0 comments

What happened:
In the previous implementation, dubbo-go-hessian2 would encode nil values of a specified type as empty bytes.

For example:

var null *int = nil

e := NewEncoder()
e.Encode(null)

len(e.buffer) == 0  // true

However, the expected encoding for nil values should be []byte("N"), regardless of the type of nil value.

What you expected to happen:
It encodes nil values of any type as []byte("N").

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?: