mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-04-05 00:43:53 -04:00
fix(noip): handle response body messages before checking status code
This commit is contained in:
@@ -146,10 +146,6 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
s := string(b)
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
return netip.Addr{}, fmt.Errorf("%w: %d: %s", errors.ErrHTTPStatusNotValid, response.StatusCode, s)
|
||||
}
|
||||
|
||||
switch s {
|
||||
case "":
|
||||
return netip.Addr{}, fmt.Errorf("%w", errors.ErrReceivedNoResult)
|
||||
@@ -167,7 +163,9 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
return netip.Addr{}, fmt.Errorf("%w", errors.ErrHostnameNotExists)
|
||||
}
|
||||
|
||||
if !strings.Contains(s, "nochg") && !strings.Contains(s, "good") {
|
||||
if response.StatusCode != http.StatusOK {
|
||||
return netip.Addr{}, fmt.Errorf("%w: %d: %s", errors.ErrHTTPStatusNotValid, response.StatusCode, s)
|
||||
} else if !strings.Contains(s, "nochg") && !strings.Contains(s, "good") {
|
||||
return netip.Addr{}, fmt.Errorf("%w: %s", errors.ErrUnknownResponse, s)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user