in src/main/scala/com/twitter/iago/util/UriParser.scala [40:73]
def apply(
str: String,
stripOauth: Boolean = true,
rewriteSince: Boolean = true,
timestamp: Long = 0
): Try[Uri] = {
val uri = new URI(str)
val args: Seq[(String, String)] = uri.getRawQuery match {
case null => Nil
case query =>
query.split("&") flatMap { kv =>
kv.split("=") match {
case Array(key, value) => Some(key -> value)
case Array(key) => Some(key -> "")
case _ => None
}
} filter {
case (key, _) =>
!stripOauth || !key.startsWith("oauth_")
} map {
case (key, value) =>
if (rewriteSince && (key == "since_id" || key == "max_id")) {
try {
(key -> shiftSnowflakeTime(timestamp, value.toLong).toString)
} catch {
case e: NumberFormatException => (key -> value)
}
} else {
(key -> value)
}
}
}
Return(Uri(uri.getPath, if (args.isEmpty) Nil else args))
}