ProductBarcode: backend: properly check barcodespider API response

This commit is contained in:
Crumb Owl
2025-07-06 19:22:32 +00:00
parent e80e5744f7
commit 94e81809d3

View File

@@ -194,6 +194,10 @@ func (ctrl *V1Controller) HandleProductSearchFromBarcode(conf config.BarcodeAPIC
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("barcodespider API returned status code: %d", resp.StatusCode)
}
// We Read the response body on the line below.
body, err := io.ReadAll(resp.Body)
if err != nil {