You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
When the message-body of an ajax request consists (initially) of a FormData object, the Content-Type of the response must be set by the UA. Just as a form submit where the form's enctype is "multipart/form-data", the UA will set the Content-Type of the request to "multipart/form-data" along with a calculated multipart boundary identifier. This is required for the server to easily parse the message-body.
I noticed that <core-ajax> has a default Content-Type of "application/x-www-form-urlencoded". If the contentType on the element instance isn't explicitly set to another value, this will be the Content-Type of the request. So, if the payload is a FormData object, the contentType must be nulled out in order to prevent <core-ajax> from setting the Content-Type, so the UA can properly set it.
It's not difficult to null out the contentType on the element instance, but it's not intuitive. Perhaps <core-ajax> should avoid setting the Content-Type of the request if the payload is a FormData object, since the Content-Type for this type of message-body must always be left alone so the UA can set it properly.
I can open up a PR with required changes, if you concur.
The text was updated successfully, but these errors were encountered:
When the message-body of an ajax request consists (initially) of a
FormData
object, the Content-Type of the response must be set by the UA. Just as a form submit where the form'senctype
is "multipart/form-data", the UA will set the Content-Type of the request to "multipart/form-data" along with a calculated multipart boundary identifier. This is required for the server to easily parse the message-body.I noticed that
<core-ajax>
has a default Content-Type of "application/x-www-form-urlencoded". If thecontentType
on the element instance isn't explicitly set to another value, this will be the Content-Type of the request. So, if the payload is aFormData
object, thecontentType
must be nulled out in order to prevent<core-ajax>
from setting the Content-Type, so the UA can properly set it.It's not difficult to null out the
contentType
on the element instance, but it's not intuitive. Perhaps<core-ajax>
should avoid setting the Content-Type of the request if the payload is aFormData
object, since the Content-Type for this type of message-body must always be left alone so the UA can set it properly.I can open up a PR with required changes, if you concur.
The text was updated successfully, but these errors were encountered: