Skip to main content
Jiri_Prokop
Jul 28, 2023 9:59 AM UTC

Custom HTTP headers in `fetch` in plugins

Hello,

I’m creating an internal Figma Plugin and I noticed that your fetch function is custom one and that not all HTTP headers are exposed by it. In fact, only content-length and content-type seems to be available.

My plugin would need to read additional information from the header since I’m using binary data (image) in the response and I don’t want to implement multipart form parsing just to add these small data (HTTP header would be very practical for it).

Is there any solution? For now I’m using a workaround to pass that data in content-type but as you can imagine, that’s not ideal 🙂

Thank you for any help.
Jiri

2 replies

tank666
Jul 28, 2023 10:16 AM UTC

You can call the plugin’s invisible UI to access the Browser API.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Jiri_Prokop
Jul 28, 2023 3:07 PM UTC

Yeah, that’s a good idea. But this will complicate my logic, I’m afraid.