I solved this by removing the header in the request :
Before :
// get articles
var Req_articles = new FormData();
Req_articles.append('set', 'get_articles');
fetch('/', {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
headers: {
'Content-Type': 'application/json'
},
mode: 'same-origin', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
body: Req_articles,
}).then( response => response.json() )
.then((data) => {
console.log(data;
});
After :
// get articles
var Req_articles = new FormData();
Req_articles.append('set', 'get_articles');
fetch('/', {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'same-origin', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
body: Req_articles,
}).then( response => response.json() )
.then((data) => {
console.log(data;
});
In fact it's logical, because what I sent is of the type "content-type: multipart/form-data" and not "application/json"
Hope to help
null)