diff options
Diffstat (limited to 'vendor/github.com/xenolf/lego/acme/error.go')
-rw-r--r-- | vendor/github.com/xenolf/lego/acme/error.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/vendor/github.com/xenolf/lego/acme/error.go b/vendor/github.com/xenolf/lego/acme/error.go index 2aa690b33..6d7013cf1 100644 --- a/vendor/github.com/xenolf/lego/acme/error.go +++ b/vendor/github.com/xenolf/lego/acme/error.go @@ -8,9 +8,7 @@ import ( "strings" ) -const ( - tosAgreementError = "Must agree to subscriber agreement before any further actions" -) +const tosAgreementError = "Must agree to subscriber agreement before any further actions" // RemoteError is the base type for all errors specific to the ACME protocol. type RemoteError struct { @@ -54,20 +52,17 @@ func (c challengeError) Error() string { func handleHTTPError(resp *http.Response) error { var errorDetail RemoteError - contenType := resp.Header.Get("Content-Type") - // try to decode the content as JSON - if contenType == "application/json" || contenType == "application/problem+json" { - decoder := json.NewDecoder(resp.Body) - err := decoder.Decode(&errorDetail) + contentType := resp.Header.Get("Content-Type") + if contentType == "application/json" || contentType == "application/problem+json" { + err := json.NewDecoder(resp.Body).Decode(&errorDetail) if err != nil { return err } } else { - detailBytes, err := ioutil.ReadAll(limitReader(resp.Body, 1024*1024)) + detailBytes, err := ioutil.ReadAll(limitReader(resp.Body, maxBodySize)) if err != nil { return err } - errorDetail.Detail = string(detailBytes) } |