Skip to content

Commit

Permalink
Fix #2317 force conversion to FormData for xhr.send (#2481)
Browse files Browse the repository at this point in the history
Couldn't get the proxy object to work properly with XMLHTTPRequest's send method.
Even though calls are being forwarded to its underlying FormData through the proxy, the request won't set its type to multipart/form-data when appropriate and instead send a text/plain request
  • Loading branch information
Telroshan authored Apr 17, 2024
1 parent 2be7054 commit 54381a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -3600,7 +3600,9 @@ var htmx = (function() {
return encodedParameters
} else {
if (usesFormData(elt)) {
return formDataFromObject(filteredParameters)
// Force conversion to an actual FormData object in case filteredParameters is a formDataProxy
// See https://github.com/bigskysoftware/htmx/issues/2317
return overrideFormData(new FormData(), formDataFromObject(filteredParameters))
} else {
return urlEncode(filteredParameters)
}
Expand Down

0 comments on commit 54381a2

Please sign in to comment.