Compare commits

...

2 Commits

Author SHA1 Message Date
bae6a964eb Merge branch '2-create-firewall-zone-api' 2025-04-13 15:20:31 +02:00
bab50ebfc4 Unifi API v2 2025-04-13 15:20:13 +02:00

View File

@@ -212,6 +212,9 @@ func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody int
if err != nil { if err != nil {
return fmt.Errorf("unable to parse URL: %s %s %w", method, relativeURL, err) return fmt.Errorf("unable to parse URL: %s %s %w", method, relativeURL, err)
} }
if !strings.Contains(relativeURL, "firewall/zone") {
c.apiPath = c.apiV2Path
}
if !strings.HasPrefix(relativeURL, "/") && !reqURL.IsAbs() { if !strings.HasPrefix(relativeURL, "/") && !reqURL.IsAbs() {
reqURL.Path = path.Join(c.apiPath, reqURL.Path) reqURL.Path = path.Join(c.apiPath, reqURL.Path)
} }