Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Specify which content types we provide. Closes #24.
Browse files Browse the repository at this point in the history
The lack of this information was causing webmachine to assume we provided
text/html (even though that's not at all true) and reject HTTP requests
which only accept application/json.
  • Loading branch information
Simon MacMullen committed Mar 3, 2015
1 parent 5840f0e commit 7c13ec0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rabbit_mgmt_wm_exchange_publish.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-module(rabbit_mgmt_wm_exchange_publish).

-export([init/1, resource_exists/2, post_is_create/2, is_authorized/2,
allowed_methods/2, process_post/2]).
allowed_methods/2, content_types_provided/2, process_post/2]).

-include("rabbit_mgmt.hrl").
-include_lib("webmachine/include/webmachine.hrl").
Expand All @@ -29,6 +29,9 @@ init(_Config) -> {ok, #context{}}.
allowed_methods(ReqData, Context) ->
{['POST'], ReqData, Context}.

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

resource_exists(ReqData, Context) ->
{case rabbit_mgmt_wm_exchange:exchange(ReqData) of
not_found -> false;
Expand Down

0 comments on commit 7c13ec0

Please sign in to comment.