Sfoglia il codice sorgente

added cast number value to float if value is string (#830)

Co-authored-by: Pavel Televich <pavel.televich@skystart.team>
Pavel 1 anno fa
parent
commit
84e49b5457
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      resources/js/tryitout.js

+ 5 - 0
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;