AJAX with zero form fields does not send Content-Type
header #5346
Open
Description
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 implicitly
the 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>