From 5e97fbb6eb7a242e7ce1d66a853b7d0f2c9f6b35 Mon Sep 17 00:00:00 2001 From: buffermet <29265684+buffermet@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:30:46 +0100 Subject: [PATCH] Update http_proxy_js_request.go --- modules/http_proxy/http_proxy_js_request.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/http_proxy/http_proxy_js_request.go b/modules/http_proxy/http_proxy_js_request.go index a3c6a1da..1eee69b6 100644 --- a/modules/http_proxy/http_proxy_js_request.go +++ b/modules/http_proxy/http_proxy_js_request.go @@ -103,6 +103,19 @@ func (j *JSRequest) WasModified() bool { return j.NewHash() != j.refHash } +func (j *JSRequest) CheckIfModifiedAndUpdateHash() bool { + newHash := j.NewHash() + // body was read + if j.bodyRead { + j.refHash = newHash + return true + } + // check if req was changed and update its hash + wasModified := j.refHash != newHash + j.refHash = newHash + return wasModified +} + func (j *JSRequest) GetHeader(name, deflt string) string { headers := strings.Split(j.Headers, "\r\n") for i := 0; i < len(headers); i++ {