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

io.youi.http.HeaderKey.scala Maven / Gradle / Ivy

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