This commit is contained in:
2025-04-13 15:35:58 +02:00
parent b079790183
commit 82702848f9

View File

@@ -212,12 +212,13 @@ 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() {
if strings.Contains(relativeURL, "firewall/zone") {
reqURL.Path = path.Join(c.apiV2Path, reqURL.Path)
} else {
reqURL.Path = path.Join(c.apiPath, reqURL.Path) reqURL.Path = path.Join(c.apiPath, reqURL.Path)
} }
}
url := c.baseURL.ResolveReference(reqURL) url := c.baseURL.ResolveReference(reqURL)
req, err := http.NewRequestWithContext(ctx, method, url.String(), reqReader) req, err := http.NewRequestWithContext(ctx, method, url.String(), reqReader)