QHL/include/http.hrl
2025-03-27 20:08:04 +09:00

26 lines
1.3 KiB
Erlang

-record(request,
{method = undefined :: undefined | method(),
path = undefined :: undefined | binary(),
qargs = undefined :: undefined | #{Key :: binary() := Value :: binary()},
fragment = undefined :: undefined | none | binary(),
version = undefined :: undefined | http10 | http11 | http20,
headers = undefined :: undefined | [{Key :: binary(), Value :: binary()}],
cookies = undefined :: undefined | #{Key :: binary() := Value :: binary()},
enctype = undefined :: undefined | none | urlencoded | multipart(),
size = undefined :: undefined | none | non_neg_integer(),
body = undefined :: undefined | none | body()}).
-record(response,
{type = page :: page | {data, string()},
version = http11 :: http11,
code = 200 :: pos_integer(),
slogan = "" :: string(),
headers = [] :: [{Key :: string(), Value :: iolist()}],
body = "" :: iolist()}).
-type method() :: get | post | options.
-type multipart() :: {multipart, Boundary :: binary()}.
-type body() :: {partial, binary()} | {multipart, [body_part()]} | binary().
-type body_part() :: {Field :: binary(), Data :: binary()}
| {Field :: binary(), Name :: binary(), Data :: binary()}.