response() = t() | non_neg_integer() | {non_neg_integer(), map(), binary()} | {non_neg_integer(), list(), binary()} | nonempty_list()
abstract datatype: t()
new/1 | Constructs a response data structure. |
write_str/2 |
new(Response::response()) -> t()
Constructs a response data structure
Arg can be one of
-
Http status code
https://tools.ietf.org/html/rfc2616#section-6.1.1
-
Response tuple
{Status, Headers, Body}
-
Response list
[Status, Headers, Body]
-
Response record. Then returns itself
Headers may be map or proplist
Example:
bookish_spork_response:new([200, #{}, <<"Hello">>])
write_str(Response::t(), Now::calendar:datetime()) -> binary()