aboutsummaryrefslogtreecommitdiff
path: root/securecookie_test.go
Commit message (Collapse)AuthorAgeFilesLines
* add test for nil hash keyKamil Kisiel2015-08-061-0/+12
|
* Move error type assertions to test file.Keunwoo Lee2015-07-271-0/+4
| | | | | Per elithrar comment on PR 28: https://github.com/gorilla/securecookie/pull/28#discussion_r35059831
* Make errors more distinguishableKeunwoo Lee2015-07-211-3/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this commit, this library raised errors either mostly using errors.New() or directly passing through error values from underlying libraries. This made it difficult for clients to respond correctly to the errors that were returned. This becomes particularly problematic when securecookie is used together with gorilla/sessions. From an operations standpoint, you often want to log different errors when the client simply provides an invalid auth cookie, versus an I/O error fetching data from the session store. The former probably indicates an expired timestamp or similar client error; the latter indicates a possible failure in a backend database. This commit introduces a public Error interface, which is now returned consistently on all errors, and can be used to distinguish between implementation errors (IsUsage() and IsInternal()) and failed validation of user input (IsDecode()). See also discussion on pull requests #9 and #24: https://github.com/gorilla/securecookie/pull/9 https://github.com/gorilla/securecookie/pull/24 Some interface comments on other API functions have been clarified and updated to harmonize with the new error interfaces.
* Merge pull request #22 from cyx/use-reflect-deepequalKamil Kisiel2015-06-061-14/+2
|\ | | | | Use reflect.DeepEqual instead
| * Use reflect.DeepEqual insteadCyril David2015-05-251-14/+2
| | | | | | | | | | Unless there's something I'm missing, probably better to delegate this check to the reflect package.
* | Added a JSON encoder/decoder to securecookie.Matt Silverlock2015-05-201-4/+27
|/ | | | | | | | | A new "Serializer" interface with serialize/deserialize methods allows custom encoders to be specified. encoding/gob remains the default for compatibility/ease-of-use reasons, but the (often faster) encoding/json is now an option. Fixed typo - TestEncription => TestEncryption
* Add test for decoding some invalid cookies.Dmitry Chestnykh2015-03-271-0/+22
|
* Add TestMissingKeyAbdülhamit Yilmaz2015-03-171-0/+10
|
* Better errors for {En,De}codeMulti.Kamil Kisiel2013-10-171-0/+13
|
* Better errors for EncodeMulti and DecodeMulti. Closes #1.moraes2012-10-131-0/+13
|
* Initial files.moraes2012-10-031-0/+152