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

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

There is a newer version: 0.5.14
Show newest version
package spice.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