Fix #2317 force conversion to FormData for xhr.send (#2481)

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
This commit is contained in:
Vincent 2024-04-17 13:53:07 +02:00 committed by GitHub
parent 2be7054525
commit 54381a2bf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
}