Skip to content

Commit

Permalink
Update terminate/2 and rest_terminate/3 callbacks to terminate/3 afte…
Browse files Browse the repository at this point in the history
…r cowboy 2.2 update (2600hz#4827)

Revert "Update terminate/2 and rest_terminate/3 callbacks to terminate/3 after cowboy 2.2 update"

This reverts commit 3fa5bd5.

Remove legacy cowboy terminate/2 callback and add expected terminate/3 for updated cowboy dep.

add specs
  • Loading branch information
mk1s authored and jamesaimonetti committed May 9, 2018
1 parent d5edce3 commit 39413fe
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions applications/crossbar/src/api_resource.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
-module(api_resource).

-export([init/2, rest_init/2
,terminate/2, rest_terminate/2
,terminate/3
,known_methods/2
,allowed_methods/2
,malformed_request/2
Expand Down Expand Up @@ -241,17 +241,16 @@ find_path(Req, Opts) ->
Magic
end.

-spec terminate(cowboy_req:req(), cb_context:context()) -> 'ok'.
terminate(_Req, _Context) ->
lager:debug("session finished").

-spec rest_terminate(cowboy_req:req(), cb_context:context()) -> 'ok'.
rest_terminate(Req, Context) ->
-spec terminate(any(), cowboy_req:req(), cb_context:context()) -> 'ok'.
terminate(_Reason, Req, Context) ->
lager:debug("session finished: ~p", [_Reason]),
rest_terminate(Req, Context, cb_context:method(Context)).

-spec rest_terminate(cowboy_req:req(), cb_context:context(), http_method()) -> 'ok'.
rest_terminate(Req, Context, ?HTTP_OPTIONS) ->
lager:info("OPTIONS request fulfilled in ~p ms"
,[kz_time:elapsed_ms(cb_context:start(Context))]),
,[kz_time:elapsed_ms(cb_context:start(Context))]
),
_ = api_util:finish_request(Req, Context),
'ok';
rest_terminate(Req, Context, Verb) ->
Expand Down

0 comments on commit 39413fe

Please sign in to comment.