I have a api where I want to upload a music. I have a put method for this..
export function put({url, headers, data}={}){
retu (dispatch, getState) => {
console.log("checking data in api")
console.log(headers)
console.log(JSON.stringify(data))
var myParams = {method: 'PUT', headers: headers, body: JSON.stringify(data)}
retu fetch(url, myParams)
}
}
Here headers is working good. I am using same for get and post and its working fine but for put its giving me cors error.
console.log(JSON.stringify(data)) gives me base64 music like:
"data:audio/mp3;base64,SUQzAwAAAAARDVRCUE0AAAAEAAAAMTIwVEVOQwAAAAwAAABpVHVuZ…QgRnVndWUgaW4gTWVsZWUAAAAAADIwMDQgMDAwMDBBRkIgMDAwMDBCOTAgMDAwMEZDRjQgMDAM"
What is wrong in here ??
My api call is taking very long more than 1.5 min... and then it fails giving cors error and 400 bad request... For other like get and post it is working..
