ApiRequest

io.eezo.http.ApiRequest
See theApiRequest companion object
final case class ApiRequest(method: Method, path: String, query: Map[String, Seq[String]], headers: Map[String, Seq[String]], body: Array[Byte], pathParams: Map[String, String])

A request on an API route: one a program sends, in which no session takes part.

A type of its own rather than a Request with an empty session, because the type a handler takes is the one place a page says what it is: a file whose handler takes this is an API route, with no declaration anywhere else to forget or to contradict. It follows that nothing a browser carries is here to read. A session, a flash, a CSRF token, the cookies and the form would each be a question with no honest answer on a route no browser session reaches, so they are absent rather than empty. The Cookie header is still among the headers, as sent, because a header is what a program chose to send and not something eezo read for it.

Public and a plain case class so that an application's test can build one and call its handler directly; only turning a served Request into one, ApiRequest.of, is eezo's own.

Attributes

Companion
object
Source
ApiRequest.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]

A header, case insensitively, first value wins.

A header, case insensitively, first value wins.

Attributes

Source
ApiRequest.scala
def param[A](name: String)(using from: FromPath[A]): A

A path parameter, converted. Throws BadRequest, which the boundary maps to a 400.

A path parameter, converted. Throws BadRequest, which the boundary maps to a 400.

Attributes

Source
ApiRequest.scala
def queryParam(name: String): Option[String]

A query parameter, first value wins.

A query parameter, first value wins.

Attributes

Source
ApiRequest.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