Packages

A simple and easy to use API created on top of the Mist web server

Current section

Files

Jump to
howdy src howdy@context@querystring.erl
Raw

src/howdy@context@querystring.erl

-module(howdy@context@querystring).
-compile(no_auto_import).
-export([get_value/2]).
-spec get_value(howdy@context:context(any()), binary()) -> {ok, list(binary())} |
{error, nil}.
get_value(Context, Key) ->
case gleam@http@request:get_query(erlang:element(3, Context)) of
{ok, Query_list} ->
_pipe = Query_list,
_pipe@1 = gleam@list:filter(
_pipe,
fun(Key_value) -> erlang:element(1, Key_value) =:= Key end
),
_pipe@2 = gleam@list:map(
_pipe@1,
fun(Key_value@1) -> erlang:element(2, Key_value@1) end
),
{ok, _pipe@2};
{error, _@1} ->
{error, nil}
end.