Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/rabbit_mgmt_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
-export([with_decode/4, not_found/3, amqp_request/4]).
-export([with_channel/4, with_channel/5]).
-export([props_to_method/2, props_to_method/4]).
-export([all_or_one_vhost/2, http_to_amqp/5, reply/3, filter_vhost/3]).
-export([all_or_one_vhost/2, http_to_amqp/5, reply/3, json_like_handlers/1,
filter_vhost/3]).
-export([filter_conn_ch_list/3, filter_user/2, list_login_vhosts/2]).
-export([with_decode/5, decode/1, decode/2, set_resp_header/3,
args/1]).
Expand Down Expand Up @@ -193,14 +194,29 @@ destination_type(ReqData) ->
<<"q">> -> queue
end.

%% Prepares a list of Content-Types that are supported by
%% reply/3. This list can be used in content_types_provided/2 callback
%% of module implementing cowboy_rest. FunctionName/2 should be
%% exported from this module and this function should use reply/3
%% under the hood.
json_like_handlers(FunctionName) ->
[{<<"application/json">>, FunctionName}
,{<<"application/bert">>, FunctionName}
].

reply(Facts, ReqData, Context) ->
reply0(extract_columns(Facts, ReqData), ReqData, Context).

reply0(Facts, ReqData, Context) ->
ReqData1 = set_resp_header(<<"Cache-Control">>, "no-cache", ReqData),
try
{mochijson2:encode(rabbit_mgmt_format:format_nulls(Facts)), ReqData1,
Context}
case cowboy_req:meta(media_type, ReqData1) of
{{<<"application">>, <<"bert">>, _}, _} ->
{term_to_binary(Facts), ReqData1, Context};
_ ->
{mochijson2:encode(rabbit_mgmt_format:format_nulls(Facts)), ReqData1,
Context}
end
catch exit:{json_encode, E} ->
Error = iolist_to_binary(
io_lib:format("JSON encode error: ~p", [E])),
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_aliveness_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case rabbit_mgmt_util:vhost(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_binding.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_bindings.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

%% The current version of Cowboy forces us to report the resource doesn't
%% exist here in order to get a 201 response. It seems Cowboy confuses the
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
case channel(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_channels.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context) ->
try
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_channels_vhost.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{rabbit_vhost:exists(rabbit_mgmt_util:id(vhost, ReqData)), ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_cluster_name.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_connection.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

allowed_methods(ReqData, Context) ->
{[<<"HEAD">>, <<"GET">>, <<"DELETE">>, <<"OPTIONS">>], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_connection_channels.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
case rabbit_mgmt_wm_connection:conn(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_connections.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context) ->
try
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_connections_vhost.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{rabbit_vhost:exists(rabbit_mgmt_util:id(vhost, ReqData)), ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_consumers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case rabbit_mgmt_util:vhost(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_definitions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{<<"application/json">>, accept_json},
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_exchange.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_exchange_publish.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ allowed_methods(ReqData, Context) ->
{[<<"POST">>, <<"OPTIONS">>], ReqData, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case rabbit_mgmt_wm_exchange:exchange(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_exchanges.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case exchanges0(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_extensions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context) ->
Modules = rabbit_mgmt_dispatcher:modules([]),
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_global_parameter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
4 changes: 2 additions & 2 deletions src/rabbit_mgmt_wm_global_parameters.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context) ->
rabbit_mgmt_util:reply_list(basic(), ReqData, Context).
Expand All @@ -44,4 +44,4 @@ is_authorized(ReqData, Context) ->
%%--------------------------------------------------------------------

basic() ->
rabbit_runtime_parameters:list_global().
rabbit_runtime_parameters:list_global().
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_healthchecks.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case node0(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_node.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case node0(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_node_memory.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{node_exists(ReqData, get_node(ReqData)), ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_node_memory_ets.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{node_exists(ReqData, get_node(ReqData)), ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_nodes.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context) ->
try
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_overview.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context = #context{user = User = #user{tags = Tags}}) ->
RatesMode = rabbit_mgmt_agent_config:get_env(rates_mode),
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_parameter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_parameters.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case basic(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_permission.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_permissions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context) ->
rabbit_mgmt_util:reply_list(permissions(), ["vhost", "user"],
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_permissions_user.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case rabbit_mgmt_wm_user:user(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_permissions_vhost.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{rabbit_vhost:exists(rabbit_mgmt_wm_vhost:id(ReqData)), ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_policies.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case basic(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_policy.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_queue_get.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ allowed_methods(ReqData, Context) ->
{[<<"POST">>, <<"OPTIONS">>], ReqData, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case rabbit_mgmt_wm_queue:queue(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_queues.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

resource_exists(ReqData, Context) ->
{case queues0(ReqData) of
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_user.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_users.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

to_json(ReqData, Context) ->
rabbit_mgmt_util:reply_list(users(), ReqData, Context).
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mgmt_wm_vhost.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ variances(Req, Context) ->
{[<<"accept-encoding">>, <<"origin">>], Req, Context}.

content_types_provided(ReqData, Context) ->
{[{<<"application/json">>, to_json}], ReqData, Context}.
{rabbit_mgmt_util:json_like_handlers(to_json), ReqData, Context}.

content_types_accepted(ReqData, Context) ->
{[{'*', accept_content}], ReqData, Context}.
Expand Down
Loading