fetch
fetch copied to clipboard
I am not able set content type-json in header always getting form data
var obj = {
"user_team": {
"match_id": "14",
"contest_id": "1",
"captain_id": "67",
"captain_id1": "67",
"player_ids": ["66", "67", "68", "69", "70"]
}}
fetch('http://172.21.25.169:3000/api/user_team/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/fanmojo;version=V1',
'TOKEN':'BObHssp-U9OctAccNSSBzA'
},
body: JSON.stringify(obj)
})
I'm assuming that you're making a request to another domain or port number and that you need to study CORS more. Please start at https://github.com/github/fetch#read-this-first