Make Get return nil instead of []byte{}

This commit is contained in:
hi019
2020-10-31 23:24:33 -05:00
parent 42714289aa
commit b84254e460
2 changed files with 2 additions and 2 deletions

View File

@@ -85,7 +85,7 @@ func (s *Storage) Get(key string) ([]byte, error) {
// If the expiration time has already passed, then return nil
if time.Now().After(time.Unix(exp, 0)) {
return []byte{}, nil
return nil, nil
}
return data, nil

View File

@@ -37,5 +37,5 @@ func Test_Expiration(t *testing.T) {
b, err := s.Get("fiber-20k-stars?")
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, []byte{}, b)
utils.AssertEqual(t, true, b == nil)
}