mirror of
https://github.com/gin-gonic/gin.git
synced 2025-05-02 07:54:26 +08:00
If a caller passed in a map retained within the callers context as extraHeaders to gin.Context.DataFromReader() then a race to write the "Content-Lenght" header would occur. // globalHeader is passed to gin.Context.DataFromReader var globalHeaders = map[string]string{ "cache-control": "public, max-age=3600", } func (c *gin.Context) { //... // DataFromReader must not write to globalHeaders c.DataFromReader(code, contentLength, contentType, reader, globalHeaders) }