Skip to content

Commit

Permalink
fix: should browse until complete by default
Browse files Browse the repository at this point in the history
  • Loading branch information
electricbubble committed Mar 3, 2022
1 parent 091a095 commit e67ef0a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
13 changes: 10 additions & 3 deletions installationproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,18 @@ func (p *installationProxy) Browse(opts ...InstallationProxyOption) (currentList
if err = respPkt.Unmarshal(&reply); err != nil {
return nil, err
}
if reply.Status != "BrowsingApplications" {
return nil, fmt.Errorf("installation proxy 'Browse' status: %s", reply.Status)
}

currentList = reply.CurrentList

for reply.Status != "Complete" {
if respPkt, err = p.client.ReceivePacket(); err != nil {
return nil, err
}
if err = respPkt.Unmarshal(&reply); err != nil {
return nil, err
}
currentList = append(currentList, reply.CurrentList)
}
return
}

Expand Down
8 changes: 6 additions & 2 deletions installationproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ func Test_installationProxy_Browse(t *testing.T) {
t.Log(len(currentList))

for _, cl := range currentList {
app := cl.(map[string]interface{})
t.Log(app)
app, ok := cl.(map[string]interface{})
if ok {
t.Log(app)
} else {
t.Log(cl)
}
}
}

Expand Down

0 comments on commit e67ef0a

Please sign in to comment.