Browse Source

Fix debug header

DarthSim 4 years ago
parent
commit
1df1a9eaa8
1 changed files with 5 additions and 5 deletions
  1. 5 5
      processing_handler.go

+ 5 - 5
processing_handler.go

@@ -98,6 +98,11 @@ func respondWithImage(ctx context.Context, reqID string, r *http.Request, rw htt
 		rw.Header().Set("Vary", headerVaryValue)
 	}
 
+	if conf.EnableDebugHeaders {
+		imgdata := getImageData(ctx)
+		rw.Header().Set("X-Origin-Content-Length", strconv.Itoa(len(imgdata.Data)))
+	}
+
 	if conf.GZipCompression > 0 && strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
 		buf := responseGzipBufPool.Get(0)
 		defer responseGzipBufPool.Put(buf)
@@ -119,11 +124,6 @@ func respondWithImage(ctx context.Context, reqID string, r *http.Request, rw htt
 		rw.Write(data)
 	}
 
-	if conf.EnableDebugHeaders {
-		imgdata := getImageData(ctx)
-		rw.Header().Set("X-Origin-Content-Length", strconv.Itoa(len(imgdata.Data)))
-	}
-
 	imageURL := getImageURL(ctx)
 
 	logResponse(reqID, r, 200, nil, &imageURL, po)