Skip to content

Commit

Permalink
Pasa validacion de error antes del defer
Browse files Browse the repository at this point in the history
  • Loading branch information
naysolange committed Sep 5, 2020
1 parent ca07bfd commit ed14017
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions precios-claros/precios_claros_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,13 @@ func (pc *PreciosClarosClient) ObtenerListaDePrecios(sucursales []string, produc
pc.sleeper.Sleep()
response, err := pc.restClient.Get(host + fmt.Sprintf(pathPrecioProducto+"?id_producto=%v", id) + sucursalesQueryString)

defer response.Body.Close()

// Valida el resultado
if err != nil {
return nil, err
}

defer response.Body.Close()

if response.StatusCode != http.StatusOK {
return nil, fmt.Errorf("el pedido dio status: %v", response.StatusCode)
}
Expand Down

0 comments on commit ed14017

Please sign in to comment.