diff options
author | Craig Peterson <cpeterson@stackoverflow.com> | 2016-10-03 08:16:01 +0300 |
---|---|---|
committer | Matt Silverlock <matt@eatsleeprepeat.net> | 2016-10-03 08:16:01 +0300 |
commit | fa5329f913702981df43dcb2a380bac429c810b5 (patch) | |
tree | d2d7093530f1a21b54c477dbd500959acde50c1a /securecookie.go | |
parent | c13558c2b1c44da35e0eb043053609a5ba3a1f19 (diff) |
[bugfix] Fix NopDecoder
* Fixes #41
Diffstat (limited to 'securecookie.go')
-rw-r--r-- | securecookie.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/securecookie.go b/securecookie.go index 83dd606..cd4e097 100644 --- a/securecookie.go +++ b/securecookie.go @@ -102,6 +102,7 @@ var ( errTimestampExpired = cookieError{typ: decodeError, msg: "expired timestamp"} errDecryptionFailed = cookieError{typ: decodeError, msg: "the value could not be decrypted"} errValueNotByte = cookieError{typ: decodeError, msg: "value not a []byte."} + errValueNotBytePtr = cookieError{typ: decodeError, msg: "value not a pointer to []byte."} // ErrMacInvalid indicates that cookie decoding failed because the HMAC // could not be extracted and verified. Direct use of this error @@ -474,12 +475,11 @@ func (e NopEncoder) Serialize(src interface{}) ([]byte, error) { // Deserialize passes a []byte through as-is. func (e NopEncoder) Deserialize(src []byte, dst interface{}) error { - if _, ok := dst.([]byte); ok { - dst = src + if dat, ok := dst.(*[]byte); ok { + *dat = src return nil } - - return errValueNotByte + return errValueNotBytePtr } // Encoding ------------------------------------------------------------------- |