From 5d7b145b45475fced0ee9ca01c50cd46b33e0e89 Mon Sep 17 00:00:00 2001 From: DC3x6 <42593507+DC3x6@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:53:58 +0800 Subject: [PATCH] add RawResponse *http.Response to HijackResponse (#1001) Co-authored-by: dc3x6 --- hijack.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hijack.go b/hijack.go index e84cedf4..829dc64b 100644 --- a/hijack.go +++ b/hijack.go @@ -230,6 +230,7 @@ func (h *Hijack) LoadResponse(client *http.Client, loadBody bool) error { defer func() { _ = res.Body.Close() }() h.Response.payload.ResponseCode = res.StatusCode + h.Response.RawResponse = res for k, vs := range res.Header { for _, v := range vs { @@ -326,8 +327,9 @@ func (ctx *HijackRequest) IsNavigation() bool { // HijackResponse context type HijackResponse struct { - payload *proto.FetchFulfillRequest - fail *proto.FetchFailRequest + payload *proto.FetchFulfillRequest + RawResponse *http.Response + fail *proto.FetchFailRequest } // Payload to respond the request from the browser.