Permalink
Browse files

Merge pull request #5 from ngaranko/master

Added DefaultValue for query_ and post_param functions inside request_wrapper
  • Loading branch information...
2 parents ce98375 + e8345a4 commit eb0e45a0024e5bb398b27c5276b8d4b9e0f25b3f @choptastic choptastic committed Mar 1, 2013
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 eb0e45a

Please sign in to comment.