0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00
cowboy/test/http_SUITE_data/http_errors.erl
Loïc Hoguin 21d9ebe33b Reverse the order of arguments of match_* functions
Wasn't following the same order as the rest of the module.
2014-10-04 13:21:16 +03:00

17 lines
500 B
Erlang

%% Feel free to use, reuse and abuse the code in this file.
-module(http_errors).
-export([init/2]).
init(Req, _Opts) ->
#{'case' := Case} = cowboy_req:match_qs(['case'], Req),
case_init(Case, Req).
case_init(<<"init_before_reply">> = Case, _Req) ->
cowboy_error_h:ignore(?MODULE, case_init, 2),
error(Case);
case_init(<<"init_after_reply">> = Case, Req) ->
cowboy_error_h:ignore(?MODULE, case_init, 2),
_ = cowboy_req:reply(200, [], "http_handler_crashes", Req),
error(Case).