Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support adding a Header to Ajax requests for Authentication through options #14

Open
jchomicki opened this issue Jun 27, 2017 · 1 comment

Comments

@jchomicki
Copy link

I'm trying to use rasterizeHTML to rasterize html that includes an image with src that points to a server which requires Authorization through a Bearer Token.

It doesn't seem there is currently any way to attach a Header to the requests made from rasterizeHTML through inlineresources. It would be very helpful to enable this functionality, then expose it through rasterizeHTML.

@cburgmer
Copy link
Owner

A workaround for now could be to replace the global instance of XMLHttpRequest with an implementation that provides this header. An example implementation of a proxy instance can be found in src/proxies.js of rasterizeHTML.js.

I still feel this is a bit of a stretch for the library, but understand that users might have different needs when fetching resources. A solution could be to provide a way to inject an alternative dependency for making calls. Ideas welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants