File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,16 @@ func (c *Control) Body(data interface{}) {
115115 }
116116 if strings .Contains (c .Request .Header .Get ("Accept-Encoding" ), "gzip" ) {
117117 c .Writer .Header ().Add ("Content-Encoding" , "gzip" )
118- c .Writer .WriteHeader (c .code )
118+ if c .code > 0 {
119+ c .Writer .WriteHeader (c .code )
120+ }
119121 gz := gzip .NewWriter (c .Writer )
120122 gz .Write (content )
121123 gz .Close ()
122124 } else {
123- c .Writer .WriteHeader (c .code )
125+ if c .code > 0 {
126+ c .Writer .WriteHeader (c .code )
127+ }
124128 c .Writer .Write (content )
125129 }
126130}
Original file line number Diff line number Diff line change 33// license that can be found in the LICENSE file.
44
55/*
6- Package router 0.3.0 provides fast HTTP request router.
6+ Package router 0.3.1 provides fast HTTP request router.
77
88The router matches incoming requests by the request method and the path.
99If a handle is registered for this path and method, the router delegates the
You can’t perform that action at this time.
0 commit comments