WardrikHTTP. Response
(wardrik_http v0.1.0-rc.1)
Copy Markdown
Sends an operation's output, or the protocol's error with its HTTP status.
Summary
Functions
Sends operation's output with its success status, or the error.
Sends error with the HTTP status for its type, as 404 for :not_found.
Sends body as JSON.
Sends a channel's response unchanged, or the error.
Functions
@spec answer( Plug.Conn.t(), WardrikProtocol.operation(), {:ok, term()} | {:error, Wardrik.Error.t()} ) :: Plug.Conn.t()
Sends operation's output with its success status, or the error.
@spec error(Plug.Conn.t(), Wardrik.Error.t()) :: Plug.Conn.t()
Sends error with the HTTP status for its type, as 404 for :not_found.
@spec json(Plug.Conn.t(), pos_integer(), term()) :: Plug.Conn.t()
Sends body as JSON.
@spec relay(Plug.Conn.t(), {:ok, map()} | {:error, Wardrik.Error.t()}) :: Plug.Conn.t()
Sends a channel's response unchanged, or the error.