mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-31 14:13:09 +02:00
v0.5.0-rc5: added proxy.exclude label, refactored some code
This commit is contained in:
@@ -2,7 +2,6 @@ package utils
|
||||
|
||||
import (
|
||||
"github.com/santhosh-tekuri/jsonschema"
|
||||
"github.com/yusing/go-proxy/common"
|
||||
)
|
||||
|
||||
var schemaCompiler = func() *jsonschema.Compiler {
|
||||
@@ -11,16 +10,13 @@ var schemaCompiler = func() *jsonschema.Compiler {
|
||||
return c
|
||||
}()
|
||||
|
||||
var schemaStorage = make(map[string] *jsonschema.Schema)
|
||||
var schemaStorage = make(map[string]*jsonschema.Schema)
|
||||
|
||||
func GetSchema(path string) *jsonschema.Schema {
|
||||
if common.NoSchemaValidation {
|
||||
panic("bug: GetSchema called when schema validation disabled")
|
||||
}
|
||||
if schema, ok := schemaStorage[path]; ok {
|
||||
return schema
|
||||
}
|
||||
schema := schemaCompiler.MustCompile(path)
|
||||
schemaStorage[path] = schema
|
||||
return schema
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user