我正在尝试将从网络摄像头录制的gif发布到Giphy API,但我不断收到此错误“ net :: ERR_ABORTED 405(不允许使用方法)”,但我真的不知道自己在做什么做错了。
fetch(`upload.giphy.com/v1/gifs?api_key=${apiKey}&file=${data}`, {
method: 'POST',
body: JSON.stringify(data),
headers: {
'Content-Type': 'image/gif'
}
})
.then((res) => {
if(res.ok){
return res.json()
}else{
console.log("Denied")
}
})
.catch((error) => {
console.log("Error " + error)
})