/test?name=myname&id=myid[
{
"id": "c816995a.3f904",
"type": "http in",
"z": "6a32c4d1.8c37e4",
"name": "",
"url": "/test/:id",
"method": "get",
"swaggerDoc": "",
"x": 170,
"y": 100,
"wires": [
[
"13251aac.37577d",
"22afeb7d.0ec63c",
"392f2a46.dac136"
]
]
},
{
"id": "8716a2c3.18b0a8",
"type": "http response",
"z": "6a32c4d1.8c37e4",
"name": "",
"x": 970,
"y": 100,
"wires": []
},
{
"id": "22afeb7d.0ec63c",
"type": "debug",
"z": "6a32c4d1.8c37e4",
"name": "",
"active": false,
"console": "false",
"complete": "true",
"x": 392,
"y": 171,
"wires": []
},
{
"id": "fbaba821.205548",
"type": "template",
"z": "6a32c4d1.8c37e4",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html ng-app=\"ngApp\">\n<head>\n</head>\n<body ng-controller=\"ngCtrl\">\n \n <h1>Topic: {[{topic}]}</h1>\n <pre>\n{[{payload | json }]}\n </pre>\n\n <script src=\"http://ajax.googleapis.com/ajax/libs/angularjs/1.4.12/angular.min.js\"></script>\n <script>\n var ngApp = angular.module('ngApp', []);\n \n ngApp.config(function($interpolateProvider) {\n $interpolateProvider.startSymbol('{[{');\n $interpolateProvider.endSymbol('}]}');\n });\n \n ngApp.controller('ngCtrl', ['$scope', function($scope) {\n // Need to wrap with TRY in case not valid JSON\n $scope.payload = JSON.parse(decodeEntities('{{payload}}'));\n $scope.topic = '{{topic}}';\n }]);\n \n function decodeEntities(encodedString) {\n var textArea = document.createElement('textarea');\n textArea.innerHTML = encodedString;\n return textArea.value;\n }\n </script>\n</body>\n</html>\n",
"x": 650,
"y": 100,
"wires": [
[
"8716a2c3.18b0a8"
]
]
},
{
"id": "13251aac.37577d",
"type": "function",
"z": "6a32c4d1.8c37e4",
"name": "",
"func": "msg.topic = msg.req.params.id;\n\nvar params = msg.req.params;\nvar query = msg.payload;\n\nmsg.payload = { \"msg.req.params\": params, \"query (msg.payload)\": query };\n\nmsg.payload = JSON.stringify(msg.payload);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 390,
"y": 100,
"wires": [
[
"fbaba821.205548"
]
]
},
{
"id": "392f2a46.dac136",
"type": "debug",
"z": "6a32c4d1.8c37e4",
"name": "",
"active": true,
"console": "false",
"complete": "true",
"x": 395,
"y": 216,
"wires": []
}
]http://localhost:1880/test/fred?jim=ben
Topic: f{
"msg.req.params": {
"id": "f",
"something": "red"
},
"query (msg.payload)": {
"jim": "ben"
}
}
So it clearly does work but you still don't need it as you should get the query parameters from the correct place in msg.req.params as I suggested. You can pull them out using a function node as I have or via a change node. Alternatively, you could act on them using a switch node if you don't need to keep track. But of course, ALL user input should be sanitised before using it in a flow.