react-snap
react-snap copied to clipboard
Add support for allowed third party domains
With skipThirdPartyRequests: true
, calls to our own APIs are blocked too . I added an allowedThirdPartyDomains
array to the options
config, to act as a whitelist.
Example usage:
// package.json
"reactSnap": {
"skipThirdPartyRequests": true,
"allowedThirdPartyDomains": ["https://api.pizzahut.io"]
}
Any request url starting with https://api.pizzahut.io will not be skipped, e.g. https://api.pizzahut.io/v1/huts/?sector=uk-1,uk-2
We love using react-snap
on https://www.pizzahut.co.uk/ and https://www.pizzahut.fr/. Thank you so much for your work, @stereobooster.
Hi Harry. Thank you for contribution. Can you please add test for this feature?
Hi @stereobooster - thanks, I'm happy to help you with this.
I'll try to write a test inside run.test.js
with a similar level of integration as the other.
Ideally I'd like to break out the function inside page.on("request", request => {...}
in skipThirdPartyRequests
, and unit test that in isolation.
@stereobooster I updated with some unit tests.
We didn't end up needing this feature at Pizza Hut, but I'm happy to help get it live if you'd still like it.
--
Actually, we do need it! Would you like me to do anything else before merging?
Any movement on this? My project uses a CDN to construct the all the routes and this would be a huge help.
this could still be great