diff --git a/src/erf.erl b/src/erf.erl index 88a8a37..6a8ed99 100644 --- a/src/erf.erl +++ b/src/erf.erl @@ -77,6 +77,9 @@ -type path_parameter() :: {binary(), binary()}. -type query_parameter() :: {binary(), binary()}. -type request() :: #{ + scheme := undefined | binary(), + host := undefined | binary(), + port := undefined | 1..65535, path := [binary()], path_parameters => [path_parameter()], method := method(), diff --git a/src/erf_router.erl b/src/erf_router.erl index 98aee22..cf199cb 100644 --- a/src/erf_router.erl +++ b/src/erf_router.erl @@ -778,6 +778,9 @@ postprocess(_Request, {Status, RawHeaders, RawBody}) -> Request :: erf:request(), Reason :: term(). preprocess(Req) -> + Scheme = elli_request:scheme(Req), + Host = elli_request:host(Req), + Port = elli_request:port(Req), Path = elli_request:path(Req), Method = preprocess_method(elli_request:method(Req)), QueryParameters = elli_request:get_args_decoded(Req), @@ -797,6 +800,9 @@ preprocess(Req) -> case njson:decode(RawBody) of {ok, Body} -> {ok, #{ + scheme => Scheme, + host => Host, + port => Port, path => Path, method => Method, query_parameters => QueryParameters, @@ -809,6 +815,9 @@ preprocess(Req) -> end; _ContentType -> {ok, #{ + scheme => Scheme, + host => Host, + port => Port, path => Path, method => Method, query_parameters => QueryParameters,