mirror of
https://github.com/gofiber/storage.git
synced 2025-10-28 10:41:27 +08:00
Make Get return nil instead of []byte{}
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user