Skip to content

Commit 1c605d8

Browse files
Merge pull request #12175 from rabbitmq/mergify/bp/v3.13.x/pr-12174
Minor fix: GET/HEAD method on non existing shovel crash (backport #12172) (backport #12174)
2 parents 504de57 + 11f2b60 commit 1c605d8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

deps/rabbitmq_shovel_management/src/rabbit_shovel_mgmt_shovel.erl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,22 @@ resource_exists(ReqData, Context) ->
4545
case name(ReqData) of
4646
none -> true;
4747
Name ->
48-
%% Deleting or restarting a shovel
4948
case get_shovel_node(VHost, Name, ReqData, Context) of
5049
undefined ->
5150
rabbit_log:error("Shovel with the name '~ts' was not found on virtual host '~ts'. "
5251
"It may be failing to connect and report its status.",
5352
[Name, VHost]),
54-
case is_restart(ReqData) of
55-
true -> false;
56-
%% this is a deletion attempt, it can continue and idempotently try to
57-
%% delete the shovel
58-
false -> true
53+
case cowboy_req:method(ReqData) of
54+
<<"DELETE">> ->
55+
%% Deleting or restarting a shovel
56+
case is_restart(ReqData) of
57+
true -> false;
58+
%% this is a deletion attempt, it can continue and idempotently try to
59+
%% delete the shovel
60+
false -> true
61+
end;
62+
_ ->
63+
false
5964
end;
6065
_ ->
6166
true

0 commit comments

Comments
 (0)