return json even if no packages are queued; fix 404
This commit is contained in:
14
main.go
14
main.go
@@ -86,6 +86,14 @@ func main() {
|
||||
if *exitCodeFlag {
|
||||
os.Exit(20)
|
||||
}
|
||||
} else {
|
||||
log.Debugf("no packages in queue")
|
||||
if *jsonFlag {
|
||||
err = json.NewEncoder(os.Stdout).Encode(JSONOut{
|
||||
Total: len(packagesInQueue),
|
||||
Packages: packagesInQueue,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +135,10 @@ func ALHPBuildQueuePkgbase() ([]string, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("ALHP api returned HTTP %d", resp.StatusCode)
|
||||
} else if resp.StatusCode == http.StatusNotFound {
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
return nil, nil
|
||||
} else if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("ALHP api returned HTTP %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
bResp, err := io.ReadAll(resp.Body)
|
||||
|
Reference in New Issue
Block a user