skip to Main Content

Reactjs – Using Fetch in REACT for PUT/PATCH doesn't work for me

Hello in my React App I use this specific comportement to handle modification (status change actived/deactived) const handleActifEspece = (index, statutActif) => { let especeAActiver = especes.find(espece => espece.id === index) especeAActiver.actif = statutActif console.log(JSON.stringify(especeAActiver)) fetch(`http://localhost:8000/api/especes/${index}`, { method: 'PUT', headers:…

VIEW QUESTION

Convert content to text parsing JSON URL response

I've got a url where the result is shown as below "playerInfo": { "059gh": { "eligiblePos": "Flx3,G,Flx,Flx2,PG", "status": "FA" }, "04mr6": { "eligiblePos": "Flx3,G,Flx,Flx2,PG", "status": "FA" }, "059fz": { "eligiblePos": "Flx3,G,Flx,Flx2,PG", "status": "FA" }, "059fw": { "eligiblePos": "Flx3,G,Flx,Flx2,PG", "status": "FA"…

VIEW QUESTION

Why are cross-origin POST requests with Content-Type 'application/json' considered to be unsafe?

According to https://javascript.info/fetch-crossorigin#unsafe-requests Safe headers – the only allowed custom headers are: ... Content-Type with the value application/x-www-form-urlencoded, multipart/form-data or text/plain. If I understand the consequences correctly: Sending a cross origin POST request with Content-Type header appliation/json will first trigger…

VIEW QUESTION
Back To Top
Search