Skip to content

Commit

Permalink
Handle arguments with no value in (post|get)_arg_decoded
Browse files Browse the repository at this point in the history
To follow the convention in (get|post)_args_decoded, return true
directly and do not attempt to uridecode it, as it will fail.
  • Loading branch information
Vagabond committed Mar 24, 2020
1 parent 1f0d65e commit 002d563
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/elli_request.erl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ get_arg_decoded(Key, #req{} = Req) ->
get_arg_decoded(Key, #req{args = Args}, Default) ->
case proplists:get_value(Key, Args) of
undefined -> Default;
true -> true;
EncodedValue ->
uri_decode(EncodedValue)
end.
Expand Down Expand Up @@ -127,6 +128,7 @@ post_arg_decoded(Key, #req{} = Req) ->
post_arg_decoded(Key, #req{} = Req, Default) ->
case proplists:get_value(Key, body_qs(Req)) of
undefined -> Default;
true -> true;
EncodedValue ->
uri_decode(EncodedValue)
end.
Expand Down

0 comments on commit 002d563

Please sign in to comment.