Check response.

This commit is contained in:
Kalle Carlbark 2019-09-11 09:45:38 +02:00
parent 7e370ae5f2
commit 16e67cac95
No known key found for this signature in database
GPG key ID: 3FC0C93C5A5A0670

View file

@ -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