Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Use logplex_api:channel_info(Vsn,ChannelId).
Browse files Browse the repository at this point in the history
Also responds with a 404 for channels that can't be found.
  • Loading branch information
archaelus committed Apr 14, 2012
1 parent 3a68643 commit d9f78c2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/logplex_api.erl
Expand Up @@ -132,10 +132,11 @@ handlers() ->
%% V2
{['GET', "^/v2/channels/(\\d+)$"], fun(Req, [ChannelId]) ->
authorize(Req),
Info = logplex_channel:info_v2(list_to_integer(ChannelId)),
not is_list(Info) andalso exit({expected_list, Info}),

{200, iolist_to_binary(mochijson2:encode({struct, Info}))}
case channel_info(api_v2, list_to_integer(ChannelId)) of
not_found -> not_found_json();
Info ->
{200, iolist_to_binary(mochijson2:encode({struct, Info}))}
end
end},

{['DELETE', "^/channels/(\\d+)$"], fun(Req, [ChannelId]) ->
Expand Down

0 comments on commit d9f78c2

Please sign in to comment.