fix network route schema; fix setting the config block for the http resource
This commit is contained in:
parent
cc3434c7e3
commit
33b52f69ec
@ -33,7 +33,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
ResourceTypes.Register([]string{"http", "https"}, HTTPFactory)
|
||||
folio.DocumentRegistry.ResourceTypes.Register([]string{"http", "https"}, HTTPFactory)
|
||||
}
|
||||
|
||||
func HTTPFactory(u *url.URL) data.Resource {
|
||||
@ -79,13 +79,15 @@ type HTTP struct {
|
||||
}
|
||||
|
||||
func NewHTTP() *HTTP {
|
||||
return &HTTP{ client: &http.Client{}, Common: &Common{ includeQueryParamsInURI: true, resourceType: HTTPTypeName, SchemeCheck: func(scheme string) bool {
|
||||
h := &HTTP{ client: &http.Client{}, Common: &Common{ includeQueryParamsInURI: true, resourceType: HTTPTypeName, SchemeCheck: func(scheme string) bool {
|
||||
switch scheme {
|
||||
case "http", "https":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
} } }
|
||||
slog.Info("NewHTTP()", "http", h)
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *HTTP) SetResourceMapper(resources data.ResourceMapper) {
|
||||
@ -320,7 +322,7 @@ func (h *HTTP) Create(ctx context.Context) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
slog.Error("HTTP.Create()", "http", h)
|
||||
slog.Error("HTTP.Create()", "http", h, "reader", h.reader)
|
||||
|
||||
copyBuffer := make([]byte, 32 * 1024)
|
||||
_, writeErr := io.CopyBuffer(h.writer, contentReader, copyBuffer)
|
||||
|
@ -3,7 +3,7 @@
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "network-route",
|
||||
"type": "object",
|
||||
"required": [ "to", "gateway", "interface", "rtid", "metric", "type", "scope" ],
|
||||
"required": [ "to", "gateway", "interface", "rtid", "metric", "routetype", "scope" ],
|
||||
"properties": {
|
||||
"to": {
|
||||
"type": "string"
|
||||
@ -24,7 +24,7 @@
|
||||
"description": "Network route metric",
|
||||
"minimum": 0
|
||||
},
|
||||
"type": {
|
||||
"routetype": {
|
||||
"type": "string",
|
||||
"description": "Network route type",
|
||||
"pattern": "^(unicast|local|broadcast|multicast|throw|unreachable|prohibit|blackhole|nat|[0-9]+)$"
|
||||
|
Loading…
Reference in New Issue
Block a user