What is the purpose of this code in gzipResponseWriter.Write:
if !w.sniffDone {
if w.Header().Get("Content-Type") == "" {
w.Header().Set("Content-Type", http.DetectContentType(b))
}
w.sniffDone = true
}
When would w.sniffDone ever be true when that first if statement is executed? Wouldn't it be easier to just write w.Header().Set("Content-Type", http.DetectContentType(b))? I may be missing something here, but some clarification would be nice.
What is the purpose of this code in gzipResponseWriter.Write:
When would w.sniffDone ever be true when that first if statement is executed? Wouldn't it be easier to just write
w.Header().Set("Content-Type", http.DetectContentType(b))
? I may be missing something here, but some clarification would be nice.Thank you, cgtdk