io.youi.http.HeaderKey.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
trait HeaderKey {
def key: String
protected def commaSeparated: Boolean
def get(headers: Headers): Option[String] = all(headers).headOption
def all(headers: Headers): List[String] = if (commaSeparated) {
headers.get(this).flatMap(_.split(',').map(_.trim))
} else {
headers.get(this)
}
}
object HeaderKey {
def apply(key: String): StringHeaderKey = new StringHeaderKey(key)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy