Skip to content

Commit fd49d7a

Browse files
authored
Fix error handling in request log template execution (#16242)
Add missing return statement after template execution error to prevent writing partial buffer contents after the error message has been logged.
1 parent f277517 commit fd49d7a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/http/request_log.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ func (h *RequestLogHandler) write(t *template.Template, in *RequestLogTemplateIn
180180
// Template execution failed. Write an error message with some basic information about the request.
181181
fmt.Fprintf(h.writer, "Invalid request log template: method: %v, response code: %v, latency: %v, url: %v\n",
182182
in.Request.Method, in.Response.Code, in.Response.Latency, in.Request.URL)
183+
return
183184
}
184185
h.writer.Write(w.Bytes())
185186
}

0 commit comments

Comments
 (0)