Open
Description
Your REST API example demonstrates a node with no defined method or path.
I tried a node with a defined path but no method, expecting the handler to then switch upon GET or POST when accessing the path.
The node resolver fails to allow such a match to take place.
Suggested change is to add a match condition for an empty method in the node:
if (node->_nodeType==nodeType) {
if (
// For handler functions, check the method declared with the node
(node->_nodeType==HANDLER_CALLBACK && ((ResourceNode*)node)->_method == method) ||
// For websockets, the specification says that GET is the only choice
(node->_nodeType==WEBSOCKET && method=="GET") ||
) {
to
if (node->_nodeType==nodeType) {
if (
// For handler functions, check the method declared with the node
(node->_nodeType==HANDLER_CALLBACK && ((ResourceNode*)node)->_method == method) ||
// For websockets, the specification says that GET is the only choice
(node->_nodeType==WEBSOCKET && method=="GET") ||
// handler must decode method
(node->_nodeType==HANDLER_CALLBACK && ((ResourceNode*)node)->_method == "")
) {