Check response.
This commit is contained in:
parent
7e370ae5f2
commit
16e67cac95
1 changed files with 3 additions and 2 deletions
|
@ -95,6 +95,7 @@ func (i *Dcim_Interfaces_Create) CreateInterface(n *NetBox) error {
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
}
|
}
|
||||||
|
fmt.Println(bytes.NewBuffer(interfaceData))
|
||||||
request, err := http.NewRequest("POST", n.RootURL+"/dcim/interfaces/", bytes.NewBuffer(interfaceData))
|
request, err := http.NewRequest("POST", n.RootURL+"/dcim/interfaces/", bytes.NewBuffer(interfaceData))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -112,10 +113,10 @@ func (i *Dcim_Interfaces_Create) CreateInterface(n *NetBox) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if response.StatusCode == http.StatusCreated {
|
if response.StatusCode == http.StatusCreated {
|
||||||
fmt.Println(data)
|
fmt.Println(string(data))
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
fmt.Println(data)
|
fmt.Println(string(data))
|
||||||
return errors.Errorf("Response was: %d\n", response.StatusCode)
|
return errors.Errorf("Response was: %d\n", response.StatusCode)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue