Skip to main content

Custom HTTP headers in `fetch` in plugins

  • July 28, 2023
  • 2 replies
  • 494 views

Jiri_Prokop

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.


Jiri_Prokop
  • Author
  • July 28, 2023

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