own the usage of reflection into the RegisterType

allowing the users to only pass instances of the interfaces
This commit is contained in:
Mohammed Al Sahaf
2022-06-14 20:51:58 +03:00
parent 52f43d2f4c
commit b825a10927
16 changed files with 50 additions and 61 deletions
+2 -3
View File
@@ -26,7 +26,6 @@ import (
"math"
"net"
"net/http"
"reflect"
"sort"
"strconv"
"strings"
@@ -38,8 +37,8 @@ import (
func init() {
caddy.RegisterModule(Encode{})
caddy.RegisterType("http.encoders", []reflect.Type{
reflect.TypeOf((*Encoding)(nil)).Elem(),
caddy.RegisterType("http.encoders", []interface{}{
(*Encoding)(nil),
})
}