Plugin api : error when using fetch with post, EVEN from the UI I’m trying to make a http query to a back-end,
i solved all the CORS issues, and it works fine when i do a GET query.
However, when i try POST, i get the following message :
'<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /</pre>\n</body>\n</html>\n'
Here is my code
const response = fetch('http://localhost:1337', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(inputData)
})
.then(result => {
console.log(result.text());
console.log(result);
});
Things i have tried :
Make the query from the UI code (i already know that the environment in the UI is less sandboxed than the back-end, but it doesn’t change anything)
use TextEncoder.enc