Response

io.eezo.http.Response
See theResponse companion object
final case class Response(status: Int, headers: Seq[(String, Url | String)], body: Body, session: Option[Session] = ...)

A response, as a value.

The status is a plain Int, reached through the named constructors below, because a framework that cannot return 418 is a framework people work around. Headers are an ordered Seq that permits duplicates, deliberately asymmetric with the request's Map: writing wants order and repetition, Set-Cookie being both, while reading wants keyed lookup. The session is carried as a value beside them rather than pre-rendered into one, because signing needs the secret and the handler does not have it.

Attributes

Companion
object
Source
Response.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def header(name: String): Option[String]

The first value carried under this name, as it goes on the wire.

The first value carried under this name, as it goes on the wire.

A header value is a Url or a String, and every reader wants the one spelling, so the flattening lives here rather than at each site that has to ask what a Location says.

Attributes

Source
Response.scala
def withCookie(cookie: Cookie): Response

Sets a cookie: one more Set-Cookie header, rendered by the cookie itself. The session cookie never goes through here from user code; it is written once, from session, after dispatch.

Sets a cookie: one more Set-Cookie header, rendered by the cookie itself. The session cookie never goes through here from user code; it is written once, from session, after dispatch.

Attributes

Source
Response.scala
def withHeader(name: String, value: Url | String): Response

Appends a header, keeping any header of the same name that is already there.

Appends a header, keeping any header of the same name that is already there.

The value is the same Url | String the header list carries, so a Location that still travels with its mount can be added to a response that already exists. Widened rather than overloaded, because String conforms to the union and every call site that passes one keeps compiling and keeps meaning a finished value.

Attributes

Source
Response.scala
def withSession(session: Session): Response

The session this response keeps: usually the request's, amended. None, the default, keeps the request's session exactly as the handler saw it, so a handler that only reads costs nothing. The cookie itself is written once, after dispatch, and only when the session changed.

The session this response keeps: usually the request's, amended. None, the default, keeps the request's session exactly as the handler saw it, so a handler that only reads costs nothing. The cookie itself is written once, after dispatch, and only when the session changed.

Attributes

Source
Response.scala

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala