Compare commits

..

1 Commits

Author SHA1 Message Date
cbc4b21d62 Added baseURL prefix 2025-11-16 14:27:39 +01:00

View File

@@ -19,7 +19,7 @@ func NewHttpClient(baseURL string) *HttpClient {
func (c *HttpClient) SendGet(url string, data, out any) error {
fmt.Printf("Sending req to: %s%s\n", c.baseURL, url)
res, err := c.sendRequest(c.baseURL, url, http.MethodGet, data)
res, err := c.sendRequest(url, http.MethodGet, data)
if err != nil {
return err
}
@@ -34,7 +34,7 @@ func (c *HttpClient) SendGet(url string, data, out any) error {
}
func (c *HttpClient) SendPost(url string, data, out any) (any, error) {
res, err := c.sendRequest(c.baseURL, url, http.MethodPost, data)
res, err := c.sendRequest(url, http.MethodPost, data)
if err != nil {
return nil, err
}
@@ -48,8 +48,8 @@ func (c *HttpClient) SendPost(url string, data, out any) (any, error) {
return out, nil
}
func (c *HttpClient) sendRequest(baseURL, actionURL, method string, data any) (*http.Response, error) {
apiUrl := baseURL + actionURL
func (c *HttpClient) sendRequest(url, method string, data any) (*http.Response, error) {
apiUrl := c.baseURL + url
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // FIXME dev mode