diff options
author | Josh Lemer <joshlemer@gmail.com> | 2017-12-29 15:31:56 -0600 |
---|---|---|
committer | Josh Lemer <joshlemer@gmail.com> | 2017-12-29 15:31:56 -0600 |
commit | 990f29cf744011f411e424edb53d99be2ba3ec18 (patch) | |
tree | 6d81d83ff1ef3466e3bc0b349defe50d53b55b13 /core/src/main/scala/com | |
parent | 0a6ed5d2d5e59accf96dc1f5ca33725e27f7df91 (diff) | |
download | sttp-990f29cf744011f411e424edb53d99be2ba3ec18.tar.gz sttp-990f29cf744011f411e424edb53d99be2ba3ec18.tar.bz2 sttp-990f29cf744011f411e424edb53d99be2ba3ec18.zip |
Remove dependence on StringTokenizer
Diffstat (limited to 'core/src/main/scala/com')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/Response.scala | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/Response.scala b/core/src/main/scala/com/softwaremill/sttp/Response.scala index 7551ee0..4d9c385 100644 --- a/core/src/main/scala/com/softwaremill/sttp/Response.scala +++ b/core/src/main/scala/com/softwaremill/sttp/Response.scala @@ -3,13 +3,7 @@ package com.softwaremill.sttp import java.net.HttpCookie import java.text.SimpleDateFormat import java.time.ZonedDateTime -import java.util.{ - Calendar, - GregorianCalendar, - Locale, - StringTokenizer, - TimeZone -} +import java.util.{Calendar, GregorianCalendar, Locale, TimeZone} import scala.collection.JavaConverters._ import scala.collection.immutable.Seq @@ -75,12 +69,11 @@ object Cookie { // hand-parsing in such case to preserve the values from the cookie val lch = h.toLowerCase val (expires, maxAge) = if (lch.contains("expires=")) { - val tokenizer = new StringTokenizer(h, ";") + val tokens = h.split(";") var e: Option[ZonedDateTime] = None var ma: Option[Long] = None - while (tokenizer.hasMoreTokens) { - val t = tokenizer.nextToken() + for (t <- tokens) { val nv = t.split("=", 2) if (nv(0).toLowerCase.contains("expires") && nv.length > 1) { e = expiryDate2ZonedDateTime(nv(1).trim()) |