Skip to content

Commit

Permalink
Merge pull request #493 from shufo/fix/empty-query-parameter
Browse files Browse the repository at this point in the history
fix: 🐛 empty query parameter sent even if input is empty
  • Loading branch information
shalvah authored Jul 8, 2022
2 parents df67746 + ba94ab9 commit 90e36aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resources/js/tryitout.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ async function executeTryOut(endpointId, form) {
const queryParameters = form.querySelectorAll('input[data-component=query]');
queryParameters.forEach(el => {
if (el.type !== 'radio' || (el.type === 'radio' && el.checked)) {
if (el.value === '' && el.required === false) {
// Don't include empty optional values in the request
return;
}

_.set(query, el.name, el.value);
}
});
Expand Down

0 comments on commit 90e36aa

Please sign in to comment.