I need to handle all request except those sent from the service server. At present, I do it using such a way: capture all requests and into handler filter service requests.
await client.Fetch.enable({
patterns: [
{ requestStage: 'Request' },
{ requestStage: 'Response' }
], // handle all requests and responses.
});
client.Fetch.on('requestPaused', async (event: RequestPausedEvent) => {
if (isServiceRoute(event.request.url))
await continueRequestOrResponse(client, event);
...
// Handle the necessary events
});
Question: Can I do this at client.Fetch.enable()
stage? E.g setup the the patterns
filter so, it passes all requests (*
) and rejects the service routes (started from https://service-domain-1.company.com
and https://service-domain-2.company.com
).