Skip to content

Commit

Permalink
Improve session cookie key deprecation warning
Browse files Browse the repository at this point in the history
Fixes #413.
  • Loading branch information
weavejester committed Oct 19, 2024
1 parent aaa27d0 commit a915a44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ring-core/src/ring/middleware/session/cookie.clj
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@

(defn- print-string-secret-key-deprecation []
(binding [*out* *err*]
(println "WARNING: The secret key for the session cookie store should be a"
"byte array.\nString secret keys have been deprecated.")))
(println "[ring.middleware.session.cookie] WARNING: The secret key for the"
"session cookie\nstore should be a byte array. Secret keys as"
"Strings have been deprecated.")))

(defn- get-secret-key
"Get a valid secret key from a map of options, or create a random one from
Expand Down
5 changes: 3 additions & 2 deletions ring-core/test/ring/middleware/session/test/cookie.clj
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
(is (= (with-out-str
(binding [*err* *out*]
(cookie-store {:key "0123456789abcdef"})))
(str "WARNING: The secret key for the session cookie store should be a"
" byte array.\nString secret keys have been deprecated.\n"))))
(str "[ring.middleware.session.cookie] WARNING: The secret key for the "
"session cookie\nstore should be a byte array. Secret keys as "
"Strings have been deprecated.\n"))))

0 comments on commit a915a44

Please sign in to comment.