Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

await e.Request.ContinueAsync(Payload) will cause the page hanging, How can I solve it? #2776

Open
phoenix1630 opened this issue Sep 7, 2024 · 1 comment

Comments

@phoenix1630
Copy link

Use await e.Request.ContinueAsync(Payload) will cause the page to freeze and remain in a "pending" state, but using await e.Request.ContinueAsync() can be used normally

My Code:

        page.Request += async (sender, e) =>
        {
            // 检查请求的类型和 URL,确定是否是 fetch 请求
            if (e.Request.ResourceType == ResourceType.Xhr || e.Request.Url.Contains("ProListInMyCart"))
            {
                var request = e.Request;
                var headers = request.Headers;
                headers["HeaderKey"] = "新HeaderValue";
                headers.Add("NewKey", "NewKey0");

                await e.Request.ContinueAsync(new Payload() //导致一直"pending"
                {
                    HasPostData = request.HasPostData,
                    Headers = request.Headers,
                    Method = request.Method,
                    PostData = request.PostData.ToString(),
                    Url = request.Url
                });

                //await e.Request.ContinueAsync(); //正常使用
            }
        }
@kblok
Copy link
Member

kblok commented Sep 13, 2024

You need to ContinueAsync outside the if block as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants