private Response CreateResponse(ChromiumInterceptableRequest request, Protocol.Network.Response responsePayload)
        {
            var getResponseBody = new Func <Task <byte[]> >(async() =>
            {
                var response = await _client.SendAsync(new NetworkGetResponseBodyRequest {
                    RequestId = request.RequestId
                }).ConfigureAwait(false);
                return(response.Base64Encoded.Value
                    ? Convert.FromBase64String(response.Body)
                    : Encoding.UTF8.GetBytes(response.Body));
            });

            return(new Response(request.Request, (HttpStatusCode)responsePayload.Status.Value, responsePayload.StatusText, responsePayload.Headers, getResponseBody));
        }
        private void HandleRequestRedirect(ChromiumInterceptableRequest request, Protocol.Network.Response responsePayload)
        {
            var response = CreateResponse(request, responsePayload);

            request.Request.RedirectChain.Add(request.Request);
            response.RequestFinished(new PlaywrightSharpException("Response body is unavailable for redirect responses"));
            _requestIdToRequest.TryRemove(request.RequestId, out _);

            if (!string.IsNullOrEmpty(request.InterceptionId))
            {
                _attemptedAuthentications.Remove(request.InterceptionId);
            }

            _page.FrameManager.RequestReceivedResponse(response);
            _page.FrameManager.RequestFinished(request.Request);
        }