nitrogen / simple_bridge

A simple, standardized interface library to Erlang HTTP Servers.
MIT License
112 stars 76 forks source link

"undefined" instead of undefined result when param not found in request #56

Closed brigadier closed 2 years ago

brigadier commented 7 years ago

this code

find_param(Param, Default, ParamList) when is_binary(Param) ->
    case lists:keyfind(Param, 1, ParamList) of
        {_, Val} -> Val;
        false -> Default
    end;
find_param(Param, Default, ParamList) when is_atom(Param); is_list(Param) ->
    Param1 = simple_bridge_util:to_binary(Param),
    simple_bridge_util:to_list(find_param(Param1, Default, ParamList)).

makes simple_bridge return "undefined" (list, not atom) for not found params when the key is a list or atom.

choptastic commented 7 years ago

Thanks, I should have time to whip up a fix for this over the weekend, otherwise I'm open to a pull request, if you feel so inclined :)

brigadier commented 7 years ago

https://github.com/nitrogen/simple_bridge/pull/57

But I'm not sure if it is enough