io.eezo.http.api

Members list

Type members

Classlikes

object Request

Attributes

Companion
class
Source
Request.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Request.type
final case class Request(method: Method, path: String, query: Map[String, Seq[String]], headers: Map[String, Seq[String]], body: Array[Byte], pathParams: Map[String, String], currentUser: Option[String] = ...)

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

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

A type of its own rather than an io.eezo.http.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.

currentUser is the one thing it carries that a program did not send: who the guard says is behind the request, read off the API token in its Bearer header and never off a session, as the key the browser's request spells it with. A handler reads it here because it holds no browser request to ask a guard about, and None is nobody, which is what every unguarded API route reads.

Public and a plain case class so that an application's test can build one and call its handler directly; only turning a served io.eezo.http.Request into one, Request.of, is eezo's own. It lives in a package of its own so that the signature says the kind of route in so many words, api.Request beside the browser's Request, rather than in a prefix on one name.

Attributes

Companion
object
Source
Request.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait Serde[A]

How a model reads from and shows as JSON on an API route, the way io.eezo.http.Form is how it reads from and shows as a form.

How a model reads from and shows as JSON on an API route, the way io.eezo.http.Form is how it reads from and shows as a form.

A seam and not an implementation, because http depends on Jetty alone: the JSON library is the application's choice, made by adding an adapter such as eezo-upickle, and the adapter is the only code that sees it. Text out and bytes in, because those are what the wire carries, so no library's value type reaches a signature here.

The message below names the adapter's module and its import literally, since an application that has neither is exactly the one that does not know what to add.

Attributes

Companion
object
Source
Serde.scala
Supertypes
class Object
trait Matchable
class Any
object Serde

Attributes

Companion
trait
Source
Serde.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Serde.type