I have a simple react application using amplitude-js to send payloads to our API. Our API controller accepts and parses json message (application/json;charset=utf-8) but amplitude-js sends data in format data.
I tried below code in my react application where I initiate amplitude intance but it doesn't work, it still sends the data in application/x-www-form-urlencoded format which is default:
const amplitudeInstance = amplitude.getInstance("test").init("21e0fe6c98573ae71d209cb8ec4e85eb", null, {
// optional configuration options
saveEvents: false,
forceHttps:false,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
apiEndpoint:'localhost:8080/events/publish',
logEvent:'test data'
})
So my question is why can't I change amplitude-js's content-type as they mention in docs:
https://developers.amplitude.com/docs/javascriptdeoland (Configuring HTTP Headers)
Thanks