Github user rob05c commented on a diff in the pull request: https://github.com/apache/incubator-trafficcontrol/pull/425#discussion_r111807542 --- Diff: traffic_monitor_golang/traffic_monitor/datareq/datareq.go --- @@ -157,16 +159,34 @@ func WrapErrCode(errorCount threadsafe.Uint, reqPath string, body []byte, err er // WrapBytes takes a function which cannot error and returns only bytes, and wraps it as a http.HandlerFunc. The errContext is logged if the write fails, and should be enough information to trace the problem (function name, endpoint, request parameters, etc). func WrapBytes(f func() []byte, contentType string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { + bytes := f() + bytes, err := gzipIfAccepts(r, w, bytes) + if err != nil { + log.Errorf("gzipping request '%v': %v\n", r.URL.EscapedPath(), err) + code := http.StatusInternalServerError + w.WriteHeader(code) + if _, err := w.Write([]byte(http.StatusText(code))); err != nil { + log.Warnf("received error writing data request %v: %v\n", r.URL.EscapedPath(), err) + } + return + } + w.Header().Set("Content-Type", contentType) - log.Write(w, f(), r.URL.EscapedPath()) + log.Write(w, bytes, r.URL.EscapedPath()) --- End diff -- Agreed.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---