hurricane: only treat first word of response body as response code (#1409)

This commit is contained in:
Chris Novakovic 2021-05-24 01:04:42 +01:00 committed by GitHub
parent 1227bb9f10
commit 25322628e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import (
"log"
"net/http"
"net/url"
"strings"
"sync"
"time"
)
@ -80,7 +81,9 @@ func (c *Client) UpdateTxtRecord(domain string, txt string) error {
}
func evaluateBody(body string, hostname string) error {
switch body {
words := strings.SplitN(body, " ", 2)
switch words[0] {
case codeGood:
return nil
case codeNoChg:

View file

@ -19,7 +19,7 @@ func TestClient_UpdateTxtRecord(t *testing.T) {
expected: assert.NoError,
},
{
code: codeNoChg,
code: codeNoChg + ` "0123456789abcdef"`,
expected: assert.NoError,
},
{