Also apply to extension widget

This commit is contained in:
Svilen Markov 2025-03-01 23:30:20 +00:00
parent a943555d86
commit 176fc896ae

View File

@ -21,7 +21,7 @@ type extensionWidget struct {
widgetBase `yaml:",inline"`
URL string `yaml:"url"`
FallbackContentType string `yaml:"fallback-content-type"`
Parameters map[string]string `yaml:"parameters"`
Parameters queryParametersField `yaml:"parameters"`
AllowHtml bool `yaml:"allow-potentially-dangerous-html"`
Extension extension `yaml:"-"`
cachedHTML template.HTML `yaml:"-"`
@ -84,7 +84,7 @@ const (
type extensionRequestOptions struct {
URL string `yaml:"url"`
FallbackContentType string `yaml:"fallback-content-type"`
Parameters map[string]string `yaml:"parameters"`
Parameters queryParametersField `yaml:"parameters"`
AllowHtml bool `yaml:"allow-potentially-dangerous-html"`
}
@ -109,14 +109,7 @@ func convertExtensionContent(options extensionRequestOptions, content []byte, co
func fetchExtension(options extensionRequestOptions) (extension, error) {
request, _ := http.NewRequest("GET", options.URL, nil)
query := url.Values{}
for key, value := range options.Parameters {
query.Set(key, value)
}
request.URL.RawQuery = query.Encode()
request.URL.RawQuery = options.Parameters.toQueryString()
response, err := http.DefaultClient.Do(request)
if err != nil {