From 4e0b19a721656d4b990a4e8a4b7588b453580217 Mon Sep 17 00:00:00 2001 From: Martin Koutsky Date: Mon, 18 Aug 2025 00:36:20 +0200 Subject: [PATCH] Added func to specify http method type when using newRequest func --- internal/glance/widget-custom-api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/glance/widget-custom-api.go b/internal/glance/widget-custom-api.go index 3c2ca755..610d8aec 100644 --- a/internal/glance/widget-custom-api.go +++ b/internal/glance/widget-custom-api.go @@ -640,6 +640,10 @@ var customAPITemplateFuncs = func() template.FuncMap { URL: url, } }, + "withMethod": func(method string, req *CustomAPIRequest) *CustomAPIRequest { + req.Method = method + return req + }, "withHeader": func(key, value string, req *CustomAPIRequest) *CustomAPIRequest { if req.Headers == nil { req.Headers = make(map[string]string)