From 84e49b545768b2c570533875faf892a4bec4e9e9 Mon Sep 17 00:00:00 2001 From: Pavel Date: Tue, 26 Mar 2024 23:37:39 +0300 Subject: [PATCH] added cast number value to float if value is string (#830) Co-authored-by: Pavel Televich --- resources/js/tryitout.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/js/tryitout.js b/resources/js/tryitout.js index a3feb1bd..01c584f2 100644 --- a/resources/js/tryitout.js +++ b/resources/js/tryitout.js @@ -194,6 +194,11 @@ async function executeTryOut(endpointId, form) { const bodyParameters = form.querySelectorAll('input[data-component=body]'); bodyParameters.forEach(el => { let value = el.value; + + if (el.type === 'number' && typeof value === 'string') { + value = parseFloat(value); + } + if (el.type === 'file' && el.files[0]) { setter(el.name, el.files[0]); return;