Skip to content

Commit

Permalink
code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollins-axway committed Sep 26, 2023
1 parent 1545878 commit adda30a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/pkg/apigee/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (a *ApigeeClient) GetRevision(proxyName, revision string) (*models.ApiProxy
return proxyRevision, nil
}

// GetRevisionBundle - get a revision bundle of a proxy with a name
// GetRevisionConnectionType - get a revision bundle and open the proxy config file
func (a *ApigeeClient) GetRevisionConnectionType(proxyName, revision string) (*HTTPProxyConnection, error) {
response, err := a.newRequest(http.MethodGet, fmt.Sprintf("%s/apis/%s/revisions/%s", a.orgURL, proxyName, revision),
WithDefaultHeaders(),
Expand All @@ -92,7 +92,7 @@ func (a *ApigeeClient) GetRevisionConnectionType(proxyName, revision string) (*H
return nil, err
}

// response is a zip file, lets
// response is a zip file, lets open it and find the proxy config file
zipReader, err := zip.NewReader(bytes.NewReader(response.Body), int64(len(response.Body)))
if err != nil {
return nil, err
Expand All @@ -111,6 +111,10 @@ func (a *ApigeeClient) GetRevisionConnectionType(proxyName, revision string) (*H
break
}

if len(fileBytes) == 0 {
return nil, fmt.Errorf("could not find the proxy configuration file in the api revision bundle")
}

data := &proxyXML{}
xml.Unmarshal(fileBytes, data)

Expand Down

0 comments on commit adda30a

Please sign in to comment.