io.youi.http.DateHeaderKey.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of youi-core_sjs0.6_2.13 Show documentation
Show all versions of youi-core_sjs0.6_2.13 Show documentation
Core functionality leveraged and shared by most other sub-projects of YouI.
The newest version!
package io.youi.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] = io.youi.YouIPlatform.parseHTTPDate(date)
def format(date: Long): String = io.youi.YouIPlatform.toHTTPDate(date)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy