You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to send a post request with SetRequestInterceptionAsync,
But I got the following: 'Request is already handled!'.
Because of the following plugin: BlockResourcesPlugin.
Code:
//'info' is an object containing my data (url, headers,etc...)
//Manage Post
if (!string.IsNullOrEmpty(info.Post))
{
await _page.SetRequestInterceptionAsync(true).ConfigureAwait(false);
_page.Request += OnRequestHandler;
async void OnRequestHandler(object s, RequestEventArgs e)
{
_page.Request -= OnRequestHandler;
var payload = new Payload()
{
Url = info.Url,
Method = HttpMethod.Post,
PostData = info.Post,
Headers = info.AdditionalHeaders
};
await e.Request.ContinueAsync(payload).ConfigureAwait(false);
await _page.SetRequestInterceptionAsync(false).ConfigureAwait(false);
}
}
await _page.GoToAsync(info.Url, new NavigationOptions { Referer = info.Referer }).ConfigureAwait(false);
The problem was raised because of the following Plugin: 'BlockResourcesPlugin', I've removed it and the code works fine now.
var blockResourcesPlugin = new BlockResourcesPlugin();
blockResourcesPlugin.AddRule(builder => builder.BlockedResources(ResourceType.StyleSheet));
extra.Use(blockResourcesPlugin);
_browser = await extra.LaunchAsync(launchOptions).ConfigureAwait(false);
The text was updated successfully, but these errors were encountered:
PuppeteerExtraSharp version: 1.3.2
PuppeteerSharp version: 6.2.0
C# .NET Framework: 4.7.0
OS: Windows 11
Plugins: StealthPlugin, BlockResourcesPlugin
I am trying to send a post request with SetRequestInterceptionAsync,
But I got the following: 'Request is already handled!'.
Because of the following plugin: BlockResourcesPlugin.
Code:
The problem was raised because of the following Plugin: 'BlockResourcesPlugin', I've removed it and the code works fine now.
The text was updated successfully, but these errors were encountered: