From 6d325a4ebe5cd7d33084e97fc74d961eac241659 Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Fri, 26 Jul 2024 22:24:35 +0700 Subject: [PATCH] feat(http): assign `customHeaders` to the map directly (#5445) also add skip expr if header key is "Host" Signed-off-by: Dwi Siswanto --- pkg/protocols/http/request.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/protocols/http/request.go b/pkg/protocols/http/request.go index 0df13b8872..2eec929808 100644 --- a/pkg/protocols/http/request.go +++ b/pkg/protocols/http/request.go @@ -1083,10 +1083,15 @@ func (request *Request) setCustomHeaders(req *generatedRequest) { req.rawRequest.Headers[k] = v } else { kk, vv := strings.TrimSpace(k), strings.TrimSpace(v) - req.request.Header.Set(kk, vv) + // NOTE(dwisiswant0): Do we really not need to convert it first into + // lowercase? if kk == "Host" { req.request.Host = vv + + continue } + + req.request.Header[kk] = []string{vv} } } }