【问题标题】:Controller filter not run in Chicago Boss控制器过滤器未在 Chicago Boss 中运行
【发布时间】: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


    【解决方案1】:

    也需要(但在 skel config 中没有注释):

    {controller_filter_modules, [http_basic_auth_filter]},
    

    【讨论】:

      猜你喜欢
      • 2014-09-30
      • 1970-01-01
      • 2013-05-04
      • 2018-07-15
      • 1970-01-01
      • 2013-05-01
      • 2016-09-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多