Don't forget to close that FD!
This commit is contained in:
parent
4f2515ba26
commit
8739969a7d
2 changed files with 3 additions and 0 deletions
|
@ -218,6 +218,7 @@ func (n *NetBox) ListDevices(d *Dcim_Devices_List, f *DeviceFilter) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
return errors.Errorf("Error: response was: %d should be %d (%s)\n", response.StatusCode, http.StatusOK, deviceurl)
|
||||
|
|
|
@ -137,6 +137,7 @@ func (n *NetBox) ListInterfaces(i *Dcim_Interfaces_List, f *InterfaceFilter) err
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
return errors.Errorf("Error: response was: %d should be %d\n", response.StatusCode, http.StatusOK)
|
||||
|
@ -178,6 +179,7 @@ func (n *NetBox) CreateInterfaces(i *Dcim_Interfaces_Create) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
if response.StatusCode == http.StatusCreated {
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue