Continuation of #6199
In my project we use GraphQL where all requests have the same URL but differs only in body. In order to use page.route(url, handler) I have to first retrieve body of request and make some checks if this is the request I am looking for. This function page.route(url, handler) does not support predicate with Request interface which makes impossible to stub requests when using GraphQL.
I envision it like this:
async routeFindingRequests(stringToSearch) {
// request instead of URL here
await this.page.route(request => {
return request.postData().includes(stringToSearch)
}, route => {
route.fulfill({
body: JSON.stringify({
someKey: "someValue"
})
})
})
}
I would like to ask you to add the ability to work with request in addition to URL in page.route(url, handler) as this is blocker for using playwright.
P.S. Initially I thought there is a need to have async predicate but I see almost all functions are synchronous in Request interface. Thus I made a change above.