Skip to content

HTTP API request to /api/nodes/{node_name} where {node_name} isn't a valid RabbitMQ node fails with 500 error. #10330

@kjnilsson

Description

@kjnilsson

Describe the bug

HTTP API request to /api/nodes/{node_name} where {node_name} isn't a valid RabbitMQ node fails with 500 error.

A 404 would be a more appropriate response.

Reproduction steps

  1. curl -v http://localhost:15672/api/nodes/NOTANODENAME'
  2. observe 500 response code

...

Expected behavior

404 would be the expected response when a resource does not exist.

Additional context

find_type(Node, [{Type, Nodes} | Rest]) ->
case lists:member(Node, Nodes) of
true -> Type;
false -> find_type(Node, Rest)
end.

This function does not handle unknown node names correction, however the intire resouce_exist callback impl could be substantially optimised by just checking the the node is in rabbit_nodes:list_members/0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions