mirror of
https://gitlab.com/pnx-tools/dns-updater.git
synced 2026-06-16 05:54:56 +02:00
ip/resolver/basic_http/service.go: return error on http status != 2xx
This commit is contained in:
parent
e0a4b6ee95
commit
6df2eb3971
1 changed files with 5 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package basic_http
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
|
|
@ -30,6 +31,10 @@ func (s Service) Lookup() (net.IP, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
return nil, fmt.Errorf("HTTP Response: %s", resp.Status)
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue