All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spice.http.DateHeaderKey.scala Maven / Gradle / Ivy

There is a newer version: 0.5.14
Show newest version
package spice.http

class DateHeaderKey(val key: String, val commaSeparated: Boolean = false) extends TypedHeaderKey[Long] {
  import DateHeaderKey._

  override def value(headers: Headers): Option[Long] = get(headers).flatMap(parse)

  override def apply(date: Long): Header = Header(this, format(date))
}

object DateHeaderKey {
  def parse(date: String): Option[Long] = spice.Platform.parseHTTPDate(date)

  def format(date: Long): String = spice.Platform.toHTTPDate(date)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy