1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-28 15:27:03 +00:00

implement #1536 with (SetRegisterRule(iris.RouteOverlap))

Former-commit-id: 2b5523ff3e2aab60dd83faa3c520b16a34916fbe
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-06-14 08:09:42 +03:00
parent 78a45163e3
commit ed5964716b
16 changed files with 210 additions and 24 deletions

View File

@@ -192,6 +192,7 @@ func (w *GzipResponseWriter) Body() []byte {
}
// ResetBody resets the response body.
// Implements the `ResponseWriterBodyReseter`.
func (w *GzipResponseWriter) ResetBody() {
w.chunks = w.chunks[0:0]
}
@@ -202,6 +203,26 @@ func (w *GzipResponseWriter) Disable() {
w.disabled = true
}
// Reset disables the gzip content writer, clears headers, sets the status code to 200
// and clears the cached body.
//
// Implements the `ResponseWriterReseter`.
func (w *GzipResponseWriter) Reset() bool {
// disable gzip content writer.
w.Disable()
// clear headers.
h := w.ResponseWriter.Header()
for k := range h {
h[k] = nil
}
// restore status code.
w.WriteHeader(defaultStatusCode)
// reset body.
w.ResetBody()
return true
}
// FlushResponse validates the response headers in order to be compatible with the gzip written data
// and writes the data to the underline ResponseWriter.
func (w *GzipResponseWriter) FlushResponse() {