In case of non 200 response return error
This commit is contained in:
parent
140e3d576c
commit
dfcedbab1e
@ -3,6 +3,7 @@ package http
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -58,7 +59,9 @@ func (r *Resolver) Resolve(name string) ([]*resolver.Record, error) {
|
||||
return nil, err
|
||||
}
|
||||
defer rsp.Body.Close()
|
||||
|
||||
if rsp.StatusCode != 200 {
|
||||
return nil, errors.New("non 200 response")
|
||||
}
|
||||
b, err := ioutil.ReadAll(rsp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user