0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00
cowboy/test/http_SUITE_data/http_errors.erl

18 lines
506 B
Erlang
Raw Normal View History

2011-12-29 00:06:22 +01:00
%% Feel free to use, reuse and abuse the code in this file.
2013-04-24 20:28:44 +02:00
-module(http_errors).
2011-12-29 00:06:22 +01:00
-export([init/2]).
init(Req, _Opts) ->
#{'case' := Case} = cowboy_req:match_qs(['case'], Req),
case_init(Case, Req).
2011-12-29 00:06:22 +01:00
case_init(<<"init_before_reply">> = Case, _Req) ->
ct_helper_error_h:ignore(?MODULE, case_init, 2),
error(Case);
2011-12-29 00:06:22 +01:00
case_init(<<"init_after_reply">> = Case, Req) ->
ct_helper_error_h:ignore(?MODULE, case_init, 2),
_ = cowboy_req:reply(200, [], "http_handler_crashes", Req),
error(Case).