Open phoenix1630 opened 3 weeks ago
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(); //正常使用 } }
You need to ContinueAsync outside the if block as well.
ContinueAsync
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: