ulixee/secret-agent

feature needed: IPuppetResourceRequest does not currently give access to the method (GET, POST, etc)

andynuss opened this issue · 1 comments

I am currently using the following methods on IPuppetPage (in the plugin) to track resources for the purpose of my own
network idle heuristic that I originally designed for puppeteer.

i.e.:

page.on('resource-failed', (event: IPuppetPageEvents['resource-failed']) => {
  ...
}
page.on('resource-loaded', (event: IPuppetPageEvents['resource-loaded']) => {
  ...
}
page.on('resource-will-be-requested', (event: IPuppetPageEvents['resource-will-be-requested']) => {
  ...
}

The one thing that is missing is to clearly distinguish from the event or event.resource objects the
difference between a GET and a POST/PUT. I.e. I wish there access to the resource(request's) method.
As with playwright.

It would be fine if the GET/POST/PUT/DELETE differentiation is only available for the 'resource-will-be-requested'
event.

BTW, I was curious why event.loaderId is missing for 'resource-failed' as it is available in the other
2 events. It would be helpful for matching up the 'resource-failed' event with the 'resource-will-be-requested' event.

@andynuss you're using what we consider to be internal APIs. I'm going to close this for now, as this is not something we are going to ever try to make a public facing api. The events you're tapping into are somewhat unpredictable out of devtools apis. In Core, we assemble what we've seen here with what we've seen in the Man-in-the-middle to produce consumable events. Let us know if you're not getting access to some kind of event in the resource API, but these details should be published in those events.