Skip to content

Commit 4db9c4b

Browse files
committed
MNT: remove unnecessary if statement
1 parent 2255751 commit 4db9c4b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pkg/archiverappliance/aaclient.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,16 @@ func archiverSingleQuery(queryUrl string) (io.ReadCloser, error) {
143143
}
144144

145145
// Return if response is valid
146+
// httpResponse must be closed by caller
146147
if httpResponse.StatusCode == http.StatusOK {
147148
return httpResponse.Body, nil
148149
}
149150

150151
// Error handling
151152
defer httpResponse.Body.Close()
152153

153-
if httpResponse.StatusCode != http.StatusOK {
154-
err := fmt.Errorf("required=200, received=%d: %w", httpResponse.StatusCode, errResponseStatusCode)
155-
return nil, err
156-
}
157-
158-
return nil, fmt.Errorf("get request has failed with unexpected error")
154+
err := fmt.Errorf("required=200, received=%d: %w", httpResponse.StatusCode, errResponseStatusCode)
155+
return nil, err
159156
}
160157

161158
func buildRegexUrl(regex string, baseURL string, limit int) string {

0 commit comments

Comments
 (0)