A quick pseudo code:
JS:
var data = new FormData();
data.append('foo', 'bar');
Joomla.request({
url: 'bla/bla/request/url',
data: data
});
PHP side:
var_dump($_POST);
Using FormData: https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects
The dump should contain array with foo => bar
The dump contain random string;
The reason of this bug is that Joomla.request
force 'Content-Type', 'application/x-www-form-urlencoded'
for all POST data:
joomla-cms/media/system/js/core-uncompressed.js
Lines 962 to 965 in 7b1d2ec
However the Content-Type should be multipart/form-data; boundary={boundary string}
. By default browser will set it correctly unles other specified.
So we should not force application/x-www-form-urlencoded'
for all POST data.
Labels |
Added:
?
|
Title |
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-01-23 10:37:28 |
Closed_By | ⇒ | Fedik |
I'll say deprecate the
Joomla.request
and use the Nativefetch
.Just for the record I think I was publicly against these (also Events) wrappers...