0

I'm trying to POST a gif I recorded from my webcam to the Giphy API, but I keep getting this Error "net::ERR_ABORTED 405 (Method Not Allowed)" and I don't really know what I'm doing wrong.

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)
  })

0 Answers0