Skip to content

Commit

Permalink
replace = with a character that does not conflict with the token stan…
Browse files Browse the repository at this point in the history
…dard
  • Loading branch information
kijanowski committed Sep 29, 2017
1 parent 086a968 commit 69ae123
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ class MultiValueSessionSerializer[T](toMap: T => Map[String, String], fromMap: M
import SessionSerializer._

override def serialize(t: T) = toMap(t)
.map { case (k, v) => urlEncode(k) + urlEncode("=") + urlEncode(v) }
.mkString(urlEncode("&"))
.map { case (k, v) => urlEncode(k) + "~" + urlEncode(v) }
.mkString("&")

override def deserialize(s: String) = {
Try {
if (s == "") Map.empty[String, String]
else {
s
.split(urlEncode("&"))
.map(_.split(urlEncode("="), 2))
.split("&")
.map(_.split("~", 2))
.map(p => urlDecode(p(0)) -> urlDecode(p(1)))
.toMap
}
Expand Down

0 comments on commit 69ae123

Please sign in to comment.