Decode URI params when using elli_request:get_arg/3 #79

Merged
merged 3 commits into from Apr 14, 2014

Projects

None yet

2 participants

@zucaritask

When sending encoded GET params, these are not being decoded correctly in elli_request:get_arg/3.

@knutin
Owner
knutin commented Apr 1, 2014

Cool! I'm thinking a bit about backwards compatibility. I know there's lots of code out there that expects get_arg/2,3 to quickly return an encoded string.

What about adding 'get_arg_decoded/2,3' (or 'get_decoded_arg/2,3') that contains your improvement.

@zucaritask

That sounds good. 👍

@knutin knutin commented on an outdated diff Apr 3, 2014
src/elli_request.erl
@@ -64,6 +66,13 @@ get_arg(Key, #req{} = Req) ->
get_arg(Key, #req{args = Args}, Default) ->
proplists:get_value(Key, Args, Default).
+get_arg_decoded(Key, #req{} = Req) ->
+ get_arg(Key, Req, undefined).
@knutin
knutin Apr 3, 2014 owner

Looks like this should call get_arg_decoded/3.

@zucaritask

Oops.. sorry.
It's done now.

@knutin knutin merged commit 49cd96e into knutin:master Apr 14, 2014

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment