Skip to content

Commit 0680bf6

Browse files
committed
added a old plugin module
1 parent d8638e0 commit 0680bf6

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

config/dev_sys.config.src

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
{plugins, [{pre_request, nova_correlation_plugin, #{}},
2323
{pre_request, nova_request_plugin, #{decode_json_body => true,
2424
read_urlencoded_body => true,
25-
parse_qs => true}}
25+
parse_qs => true}},
26+
{pre_requeset, nova_request_old_plugin, #{}}
2627
]},
2728
{use_persistent_term, true},
2829
{use_strict_routing, true},

src/nova_request_old_plugin.erl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
-module(nova_request_old_plugin).
2+
-behaviour(nova_plugin).
3+
4+
-export([
5+
pre_request/2,
6+
post_request/2,
7+
plugin_info/0
8+
]).
9+
10+
%%--------------------------------------------------------------------
11+
%% @doc
12+
%% Pre-request callback
13+
%% @end
14+
%%--------------------------------------------------------------------
15+
-spec pre_request(Req :: cowboy_req:req(), Options :: map()) ->
16+
{ok, Req0 :: cowboy_req:req()} |
17+
{stop, Req0 :: cowboy_req:req()} |
18+
{error, Reason :: term()}.
19+
pre_request(Req, _Options) ->
20+
{ok, Req}.
21+
22+
23+
%%--------------------------------------------------------------------
24+
%% @doc
25+
%% Post-request callback
26+
%% @end
27+
%%--------------------------------------------------------------------
28+
-spec post_request(Req :: cowboy_req:req(), Options :: map()) ->
29+
{ok, Req0 :: cowboy_req:req()} |
30+
{stop, Req0 :: cowboy_req:req()} |
31+
{error, Reason :: term()}.
32+
post_request(Req, _Options) ->
33+
{ok, Req}.
34+
35+
36+
%%--------------------------------------------------------------------
37+
%% @doc
38+
%% nova_plugin callback. Returns information about the plugin.
39+
%% @end
40+
%%--------------------------------------------------------------------
41+
-spec plugin_info() -> {Title :: binary(), Version :: binary(), Author :: binary(), Description :: binary(),
42+
[{Key :: atom(), OptionDescription :: atom()}]}.
43+
plugin_info() ->
44+
{<<" plugin">>,
45+
<<"0.0.1">>,
46+
<<"User <user@email.com">>,
47+
<<"Descriptive text">>,
48+
[]}. %% Options is specified as {Key, Description}

0 commit comments

Comments
 (0)