fix: refactor manual arguments to url.Values
Some checks failed
CI / build (push) Failing after 3m24s
CI / lint (push) Failing after 2m51s
CI / pkl-validate (push) Successful in 10s
CI / integration-tests (push) Has been skipped
CI / conformance-tests (latest) (push) Has been skipped

This commit is contained in:
2026-02-03 23:01:16 +01:00
parent 35a789d5d9
commit e71d964f2c
2 changed files with 25 additions and 8 deletions

View File

@@ -1,11 +1,13 @@
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
)
@@ -53,8 +55,12 @@ func createAuthorizationString(username, token string) string {
return "PVEAPIToken=" + username + "=" + token
}
func authenticatedRequest(method, url, authorization string, body io.Reader) ([]byte, error) {
func authenticatedRequest(method, url, authorization string, urlparams url.Values) ([]byte, error) {
client := &http.Client{}
body := &bytes.Buffer{}
if urlparams != nil {
body = bytes.NewBuffer([]byte(urlparams.Encode()))
}
request, err := http.NewRequest(method, url, body)
if err != nil {