Action.Http cuts off the first and last digit of the value of a Input.Number substitution.
It does this because StringWithSubstitutions::substituteInputValues() calls JSON.stringify(), then removes the first and last character:
|
valueForReplace = JSON.stringify(valueForReplace); |
|
valueForReplace = valueForReplace.slice(1, -1); |
Presumably it was written assuming the .value will always be a string and therefore be wrapped in double quotes, but in this case, it's a number, and the JSON numbers are unquoted.
For example, entering the number 12.34 will result in a JSON payload of "2.3".
Action.Http Snippet
"body": "{\"numberProperty\":\"{{aNumberInput.value}}\"}",
HTTP POST Body
{"numberProperty":"2.3"}"
Card JSON
{
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Number",
"id": "aNumberInput"
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Http",
"title": "Submit",
"method": "POST",
"url": "https://example.com",
"body": "{\"numberProperty\":\"{{aNumberInput.value}}\"}",
"headers": [
{
"name": "Authorization",
"value": ""
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
previously reported #5218
Version Tested: adaptivecards@.0.6
Action.Httpcuts off the first and last digit of the value of a Input.Number substitution.It does this because
StringWithSubstitutions::substituteInputValues()callsJSON.stringify(), then removes the first and last character:AdaptiveCards/source/nodejs/adaptivecards/src/shared.ts
Lines 117 to 118 in 23b0987
Presumably it was written assuming the
.valuewill always be a string and therefore be wrapped in double quotes, but in this case, it's a number, and the JSON numbers are unquoted.For example, entering the number
12.34will result in a JSON payload of"2.3".Action.Http Snippet
HTTP POST Body
{"numberProperty":"2.3"}"Card JSON
{ "type": "AdaptiveCard", "body": [ { "type": "Input.Number", "id": "aNumberInput" }, { "type": "ActionSet", "actions": [ { "type": "Action.Http", "title": "Submit", "method": "POST", "url": "https://example.com", "body": "{\"numberProperty\":\"{{aNumberInput.value}}\"}", "headers": [ { "name": "Authorization", "value": "" }, { "name": "Content-Type", "value": "application/json" } ] } ] } ], "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.0" }previously reported #5218
Version Tested: adaptivecards@.0.6