mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-29 10:12:32 -04:00
Improve tests, fix a few lint warnings
This commit is contained in:
@@ -40,8 +40,8 @@ func NewResponseFilterWriter(filters []ResponseFilter, gz *gzipResponseWriter) *
|
||||
return &ResponseFilterWriter{filters: filters, gzipResponseWriter: gz}
|
||||
}
|
||||
|
||||
// Write wraps underlying WriteHeader method and compresses if filters
|
||||
// are satisfied.
|
||||
// WriteHeader wraps underlying WriteHeader method and
|
||||
// compresses if filters are satisfied.
|
||||
func (r *ResponseFilterWriter) WriteHeader(code int) {
|
||||
// Determine if compression should be used or not.
|
||||
r.shouldCompress = true
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestLengthFilter(t *testing.T) {
|
||||
var filters []ResponseFilter = []ResponseFilter{
|
||||
var filters = []ResponseFilter{
|
||||
LengthFilter(100),
|
||||
LengthFilter(1000),
|
||||
LengthFilter(0),
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/mholt/caddy/middleware"
|
||||
)
|
||||
|
||||
// Operators
|
||||
const (
|
||||
// Operators
|
||||
Is = "is"
|
||||
Not = "not"
|
||||
Has = "has"
|
||||
|
||||
@@ -76,7 +76,7 @@ type ComplexRule struct {
|
||||
*regexp.Regexp
|
||||
}
|
||||
|
||||
// NewRegexpRule creates a new RegexpRule. It returns an error if regexp
|
||||
// NewComplexRule creates a new RegexpRule. It returns an error if regexp
|
||||
// pattern (pattern) or extensions (ext) are invalid.
|
||||
func NewComplexRule(base, pattern, to string, ext []string, ifs []If) (*ComplexRule, error) {
|
||||
// validate regexp if present
|
||||
|
||||
Reference in New Issue
Block a user