Skip to content

Commit

Permalink
Wiretap doesn't handle multi-value header keys correctly when writing…
Browse files Browse the repository at this point in the history
… the response
  • Loading branch information
jacobm-splunk authored and daveshanley committed Jun 2, 2024
1 parent effef1f commit fb694d0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion daemon/handle_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ func (ws *WiretapService) handleHttpRequest(request *model.Request) {
// write headers
for k, v := range headers {
for _, j := range v {
request.HttpResponseWriter.Header().Set(k, fmt.Sprint(j))
responseHeaders := request.HttpResponseWriter.Header()

if responseHeaders.Get(k) == "" {
request.HttpResponseWriter.Header().Set(k, fmt.Sprint(j))
} else {
request.HttpResponseWriter.Header().Add(k, fmt.Sprint(j))
}
}
}
config.Logger.Info("[wiretap] request completed", "url", request.HttpRequest.URL.String(), "code", returnedResponse.StatusCode)
Expand Down

0 comments on commit fb694d0

Please # to comment.