let data = new FormData();
data.append("metadata", JSON.stringify({"type": type}));
data.append("requireSignedURLs", "true");
const result = await axios.post(`https://api.cloudflare.com/client/v4/accounts/${process.env.CLOUDFLARE_IMAGE_ID}/images/v2/direct_upload`, data, {
headers: {
'Authorization': `Bearer ${process.env.CLOUDFLARE_IMAGE_TOKEN}`,
'Content-Type': `multipart/form-data`,
}
})
response:
status: 400,
statusText: ‘Bad Request’,
What is wrong plz help
axios version 0.27.0 +
const result = await axios.post(`https://api.cloudflare.com/client/v4/accounts/${process.env.CLOUDFLARE_IMAGE_ID}/images/v2/direct_upload`, {
metadata: JSON.stringify({type: type}),
requireSignedURLs: "true"
}, {
headers: {
'Authorization': `Bearer ${process.env.CLOUDFLARE_IMAGE_TOKEN}`,
'Content-Type': `multipart/form-data`,
}
})
By looking at the code, it’s likely content-type missing boundary?
system
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.