'how to set headers for an item in formData in angular/javascript?

I want to set customeheader on an item of my formData. I am currently using "form-data" library but unfortunately nothing was shown as a header in the network tab.

Here is my code:

import FormData from "form-data";
formData.append(key, value, { header: {"X-Custom-Header":"34234234"} })

also this is my network log:

------WebKitFormBoundaryccq9RNX2QmnHQ3oN
Content-Disposition: form-data; name="documentImage"; filename="[object Object]"

Content-Type: image/jpeg



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source