Add withAllowInsecure func

pull/624/merge
Svilen Markov 2025-08-05 16:21:06 +07:00
parent 148b6ad5a7
commit 52b1f89a7c
1 changed files with 14 additions and 0 deletions

@ -679,6 +679,20 @@ var customAPITemplateFuncs = func() template.FuncMap {
req.BodyType = "string"
return req
},
"withAllowInsecure": func(val any, req *CustomAPIRequest) *CustomAPIRequest {
switch v := val.(type) {
case bool:
req.AllowInsecure = v
case string:
if strings.ToLower(v) == "true" {
req.AllowInsecure = true
}
default:
slog.Warn("withAllowInsecure called with non-boolean value, must be string or bool", "value", v)
}
return req
},
"getResponse": func(req *CustomAPIRequest) *customAPIResponseData {
err := req.initialize()
if err != nil {