Closed nghiepdev closed 6 years ago
maybe try making the Foobaz
value a string
also change your method to POST
if you're sending a body
GET passes data in the form of a query string (eg. foo=2&bar=2
)
fetch(URL, {
'GET', // <--- change this to POST
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
'Foobaz': 1234567 // <--- change 1234567 to '1234567'
},
})
Have you set mode
to no-cors
(for development) by any chance? In that case, it's not possible to set the Content-Type
header, as seen here.
Just tripped over this myself and lost 2 hours, hope it helps.
@tronghiep92 How did you solve that?
Hi all, I have a code example:
With app SPA, I cannot get my header.
Please help, thanks!!!!!