You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the general case this is fine however there are cases where you need to set specific options per request. For example, if you have two images within the DOM nodes that you are converting, one that requires credentials but another that doesn't and has Access-control-Allow-Origin set to * then the conversion will fail due to CORS restrictions. There are likely other cases where this is important.
Expected Behaviour
The fetchRequestInit options should allow you to specify the options per resourceUrl which would give the user full control over how the request is handled.
Possible Solution
Te fetchRequestUrl should support the ability to be a function that takes the parameter resourceUrl and returns the RequestInit options.
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
The
fetchRequestInit
options available on the conversion functions are only available as a global option. The logic for this can be found here: https://github.com/bubkoo/html-to-image/blob/master/src/dataurl.ts#L86.For the general case this is fine however there are cases where you need to set specific options per request. For example, if you have two images within the DOM nodes that you are converting, one that requires credentials but another that doesn't and has
Access-control-Allow-Origin
set to*
then the conversion will fail due to CORS restrictions. There are likely other cases where this is important.Expected Behaviour
The
fetchRequestInit
options should allow you to specify the options perresourceUrl
which would give the user full control over how the request is handled.Possible Solution
Te
fetchRequestUrl
should support the ability to be a function that takes the parameterresourceUrl
and returns theRequestInit
options.e.g.
This would let the user then do:
This would then also be backwards compatible without a breaking change.
The text was updated successfully, but these errors were encountered: