diff options
author | Loïc Hoguin <[email protected]> | 2012-01-23 07:55:08 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-01-23 07:55:08 +0100 |
commit | 3078e94db6dbd67fa27377d66aecce4c01cf6b2d (patch) | |
tree | 4f803e46fff97a8b49731ae84c372f6faca57a5d /src/cowboy_http_rest.erl | |
parent | 7482c0de754337cab03dae6a91cb2a59a15a3012 (diff) | |
download | cowboy-3078e94db6dbd67fa27377d66aecce4c01cf6b2d.tar.gz cowboy-3078e94db6dbd67fa27377d66aecce4c01cf6b2d.tar.bz2 cowboy-3078e94db6dbd67fa27377d66aecce4c01cf6b2d.zip |
Improve the return value for cowboy_http_rest:upgrade/4
Diffstat (limited to 'src/cowboy_http_rest.erl')
-rw-r--r-- | src/cowboy_http_rest.erl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cowboy_http_rest.erl b/src/cowboy_http_rest.erl index 35f82e3..a9fb7d0 100644 --- a/src/cowboy_http_rest.erl +++ b/src/cowboy_http_rest.erl @@ -53,7 +53,8 @@ %% You do not need to call this function manually. To upgrade to the REST %% protocol, you simply need to return <em>{upgrade, protocol, {@module}}</em> %% in your <em>cowboy_http_handler:init/3</em> handler function. --spec upgrade(pid(), module(), any(), #http_req{}) -> {ok, #http_req{}}. +-spec upgrade(pid(), module(), any(), #http_req{}) + -> {ok, #http_req{}} | close. upgrade(_ListenerPid, Handler, Opts, Req) -> try case erlang:function_exported(Handler, rest_init, 2) of @@ -73,7 +74,7 @@ upgrade(_ListenerPid, Handler, Opts, Req) -> "** Request was ~p~n** Stacktrace: ~p~n~n", [Handler, Class, Reason, Opts, Req, erlang:get_stacktrace()]), {ok, _Req2} = cowboy_http_req:reply(500, Req), - ok + close end. service_available(Req, State) -> |