puppeteer-sharp
puppeteer-sharp copied to clipboard
Allow customization of fetch patterns
Customization of fetch patterns including specifying the RequestStage and ResourceType
Hey @syscafedevelopment. Could you tell me a real use case scenario? So I can try to propose this upstream (a.k.a puppeteer).
We would also need some tests for this.
And by the way. Thank you for your time contributing :)
Hey @kblok,
A scenario would be:
- the dev wants to download a certain resource (e.g., a video, a pdf, etc.)
- when the request interception is made, the dev will need to call Chrome's Fetch.getResponseBody or Fetch.takeResponseBodyAsStream
- however, this will require the interception to happen at
HeadersReceivedstage - additionally, the dev only needs to intercept those specific resource types, having predefined URL patterns
- at the moment, all interceptions are at
Requeststage, with a hardcoded pattern of"*", which does not allow response body interceptions, nor selective interceptions
Apparently there are several complains and complicated workarounds about allowing downloading things via Puppeteer, which would start to be solved by customizing the interception stage first.
About unit tests, I'll handle those as soon as possible.
@kblok, any idea why this is failing AppVeyor? It seems it needs Mono.Posix assembly? Why?
@syscafedevelopment it seems that ShouldEmitCreatedAndDestroyedEvents is getting stuck...
On the other hand, I like this feature, but I'm waiting for Puppeteer's feedback here https://github.com/GoogleChrome/puppeteer/issues/4624. I don't want us to implement a feature and then they implement the same feature in a different way and we would be forced to change our API.
@syscafedevelopment could you share your case here https://github.com/GoogleChrome/puppeteer/issues/4624 ?
@kblok @syscafedevelopment Is this planned to be merged soon please?
@emiliavanderwerf I could try to push a little bit upstream to see if we get this implemented in puppeteer.
@kblok Ah, so not even Puppeteer implements this yet?
@emiliavanderwerf exactly.