fix network route schema; fix setting the config block for the http resource
Some checks failed
Lint / golangci-lint (push) Failing after 10m31s
Declarative Tests / test (push) Successful in 41s

This commit is contained in:
Matthew Rich 2024-09-28 19:50:24 +00:00
parent cc3434c7e3
commit 33b52f69ec
2 changed files with 7 additions and 5 deletions

View File

@ -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)

View File

@ -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]+)$"