【发布时间】:2017-03-12 20:42:25
【问题描述】:
我正在尝试编写一个控制器过滤器(src/lib/http_basic_auth_filter.erl):
-module(http_basic_auth_filter).
-export([before_filter/2]).
-compile({parse_transform, lager_transform}).
before_filter(Config, RequestContext) ->
lager:info("Config:~p",[Config]),
lager:info("RequestContex:~p",[RequestContext]),
Request = proplists:get_value(request, RequestContext),
Authorization = Request:header(authorization),
laget:info("Authorization:~p", [Authorization]),
{ok, RequestContext}.
我在boss.config 中配置了控制器过滤器:
{controller_filter_config, [
{lang, auto},
{http_basic_auth_filter, undefined}
]},
但是当我访问一个 URL 时,过滤器没有运行,因为我从来没有看到日志消息。我都喜欢在:https://github.com/ChicagoBoss/ChicagoBoss/blob/master/READMEs/README_FILTERS.md
控制器过滤器如何运行?我在 Google 和 Stackoverflow 中搜索过,但没有看到下降的内容。
【问题讨论】:
标签: erlang chicagoboss