From 9a20e54b2861a3c0b594d8c00680d9bcad791144 Mon Sep 17 00:00:00 2001 From: yungtravla Date: Wed, 21 Mar 2018 23:52:48 +1000 Subject: [PATCH] Update http_proxy_js_request.go --- modules/http_proxy_js_request.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/http_proxy_js_request.go b/modules/http_proxy_js_request.go index 76587c08..48555fa8 100644 --- a/modules/http_proxy_js_request.go +++ b/modules/http_proxy_js_request.go @@ -109,6 +109,15 @@ func (j *JSRequest) SetHeader(name, value string) { j.Headers = append(j.Headers, JSHeader{name, value}) } +func (j *JSRequest) RemoveHeader(name string) { + name = strings.ToLower(name) + for i, h := range j.Headers { + if name == strings.ToLower(h.Name) { + j.Headers = append(j.Headers[:i], j.Headers[i+1:]...) + } + } +} + func (j *JSRequest) ReadBody() string { raw, err := ioutil.ReadAll(j.req.Body) if err != nil {