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
Request Content-Type is/can be used by a webserver to determine the request type [1].
Array/form data should always send Content-Type. Data of value "empty array" must send the header the same way as non-empty array data. This is also behaviour of native html form /wo any fields [2].
non-array data ("null"/"undefined"/"false") can/should (probably) continue to send no Content-Type header implicitly
The text was updated successfully, but these errors were encountered:
mvorisek
changed the title
[API] serializeForm with no form fields does not send Content-Type header
AJAX with no form fields does not send Content-Type header
Oct 12, 2023
mvorisek
changed the title
AJAX with no form fields does not send Content-Type header
AJAX with zero form fields does not send Content-Type header
Oct 12, 2023
Thanks for opening an issue. It'd be helpful if you could create a reduced test case (possibly using httpbin.org) and we can see if the behavior for your use case (1) is intended and (2) can be changed. A call to $.ajax may be too late in the process to determine the correct header, so setting it explicitly is probably still the best option.
see fomantic/Fomantic-UI#2926 issue and related discussion
Request
Content-Type
is/can be used by a webserver to determine the request type [1].Array/form data should always send
Content-Type
. Data of value "empty array" must send the header the same way as non-empty array data. This is also behaviour of native html form /wo any fields [2].non-array data ("null"/"undefined"/"false") can/should (probably) continue to send no
Content-Type
header implicitlythe LoC/condition to fix: https://github.com/jquery/jquery/blob/3.7.1/src/ajax.js#L638
[1] example https://github.com/Nyholm/psr7-server/blob/1.0.2/src/ServerRequestCreator.php#L62
[2]
<form action="/p.aspx" method="post"><input type="submit"></form>
The text was updated successfully, but these errors were encountered: