Compare commits

..

5 Commits

View File

@@ -212,12 +212,11 @@ func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody int
if err != nil {
return fmt.Errorf("unable to parse URL: %s %s %w", method, relativeURL, err)
}
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)
if !strings.Contains(relativeURL, "firewall/zone") {
c.apiPath = c.apiV2Path
}
if !strings.HasPrefix(relativeURL, "/") && !reqURL.IsAbs() {
reqURL.Path = path.Join(c.apiPath, reqURL.Path)
}
url := c.baseURL.ResolveReference(reqURL)