Skip to main content
Jiri_Prokop
July 28, 2023

Custom HTTP headers in `fetch` in plugins

  • July 28, 2023
  • 2 replies
  • 551 views

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
July 28, 2023

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
July 28, 2023

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