Permalink
Browse files

Adding DefaultValue for query_param and post_param. Added param func

  • Loading branch information...
ngaranko committed Feb 27, 2013
1 parent ce98375 commit e8345a4eaf5b93bcacfb0e18480bce7db8ad7e6b
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/simple_bridge_request_wrapper.erl
@@ -45,7 +45,10 @@ cookie(Cookie) ->
query_params() -> Mod:query_params(Req).
query_param(Param) ->
- proplists:get_value(Param, query_params()).
+ query_param(Param, undefined).
+
+query_param(Param, DefaultValue) ->
+ proplists:get_value(Param, query_params(), DefaultValue).
post_params() ->
case {request_method(), IsMultiPart} of
@@ -56,7 +59,16 @@ post_params() ->
end.
post_param(Param) ->
- proplists:get_value(Param, post_params()).
+ post_param(Param, undefined).
+
+post_param(Param, DefaultValue) ->
+ proplists:get_value(Param, post_params(), DefaultValue).
+
+param(Param) ->
+ param(Param, undefined).
+
+param(Param, DefaultValue) ->
+ post_param(Param, query_param(Param, DefaultValue)).
post_files() -> PostFiles.

0 comments on commit e8345a4

Please sign in to comment.