mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Properly handle external exits of request processes
Because the exit reason doesn't include the stacktrace they were ignored. Now they are properly handled. The error message was changed slightly to accomodate.
This commit is contained in:
parent
cc97c770fb
commit
fbd680f0f6
3 changed files with 17 additions and 4 deletions
|
@ -45,6 +45,7 @@ end_per_group(Name, _) ->
|
|||
|
||||
init_dispatch(_) ->
|
||||
cowboy_router:compile([{"localhost", [
|
||||
{"/crash/external_exit", crash_h, external_exit},
|
||||
{"/crash/no_reply", crash_h, no_reply},
|
||||
{"/crash/reply", crash_h, reply}
|
||||
]}]).
|
||||
|
@ -78,3 +79,13 @@ crash_before_reply(Config) ->
|
|||
]),
|
||||
{response, fin, 500, _} = gun:await(ConnPid, Ref),
|
||||
gun:close(ConnPid).
|
||||
|
||||
external_exit_before_reply(Config) ->
|
||||
doc("A plain handler exits externally before a response was sent "
|
||||
"results in a 500 response."),
|
||||
ConnPid = gun_open(Config),
|
||||
Ref = gun:get(ConnPid, "/crash/external_exit", [
|
||||
{<<"accept-encoding">>, <<"gzip">>}
|
||||
]),
|
||||
{response, fin, 500, _} = gun:await(ConnPid, Ref),
|
||||
gun:close(ConnPid).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue