Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 073e6f2

Browse files
committed
Reverse the filter such that it's always done after the last.
- Trace when it's disabled.
1 parent f0e4574 commit 073e6f2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compress.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type CompressResponseWriter struct {
4444
}
4545

4646
func CompressFilter(c *Controller, fc []Filter) {
47+
fc[0](c, fc[1:])
4748
if Config.BoolDefault("results.compressed", false) {
4849
if c.Response.Status != http.StatusNoContent && c.Response.Status != http.StatusNotModified {
4950
writer := CompressResponseWriter{c.Response.Out, nil, "", false, make(chan bool, 1), nil, false}
@@ -53,9 +54,10 @@ func CompressFilter(c *Controller, fc []Filter) {
5354
writer.parentNotify = w.CloseNotify()
5455
}
5556
c.Response.Out = &writer
57+
} else {
58+
TRACE.Printf("Compression disabled for response status (%d)", c.Response.Status)
5659
}
5760
}
58-
fc[0](c, fc[1:])
5961
}
6062

6163
func (c CompressResponseWriter) CloseNotify() <-chan bool {

0 commit comments

Comments
 (0)