Send image to API with HttpClient Post
Hello. How to correct send image to api? Used several ways, but for some reason I get BadRequest. In API documentation they use this example nodejs code:
await fetch("url", {
method: "POST",
body: fs.readFileSync("demo.jpg"),
headers: { "Content-type": "image/jpeg" },
}).then((e) => e.json());
1 Reply
the example seems to send the bytes directly as the body
but you are sending formdata
i would expect something like this:
or similar 😉