Permalink
Browse files

Convenience function to get request body

  • Loading branch information...
1 parent 044c0af commit 6251969699f49b9000f94bc997d85798877d7046 @gar1t committed Apr 27, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/modlib.erl
View
@@ -6,7 +6,7 @@
-export([httpd_config/1]).
--export([headers/1, parse_qs/1, parse_body/1]).
+-export([headers/1, parse_qs/1, parse_body/1, body/1]).
-define(DEFAULT_SERVER_ROOT, ".").
-define(DEFAULT_DOCUMENT_ROOT, ".").
@@ -75,6 +75,14 @@ parse_body(#mod{parsed_header=Header, entity_body=Body}) ->
end.
%%--------------------------------------------------------------------
+%% @doc Returns the request unmodified body.
+%% @spec body(Info) -> binary()
+%% @end
+%%--------------------------------------------------------------------
+
+body(#mod{entity_body=Body}) -> Body.
+
+%%--------------------------------------------------------------------
%% @doc Returns a validated inets httpd config for a modlib config.
%% @spec httpd_config(modlib_config()) -> httpd_config()
%% @end
@@ -153,7 +161,7 @@ wrap_webapps(Mods) ->
%%--------------------------------------------------------------------
is_webapp(Mod) ->
- Behaviors = [Value || {Name, Value} <- Mod:module_info(attributes),
+ Behaviors = [Value || {Name, Value} <- Mod:module_info(attributes),
Name == behavior orelse Name == behaviour],
lists:any(fun(M) -> M == [modlib_webapp] end, Behaviors).

0 comments on commit 6251969

Please sign in to comment.