From 0e2937900b224325f4476745a9b53aef246b7410 Mon Sep 17 00:00:00 2001 From: Mahmoud Abdelsalam Date: Fri, 17 Mar 2017 11:58:44 -0700 Subject: [PATCH] Add error checking for the jws httpPost (#360) https://github.com/xenolf/lego/issues/359 --- acme/jws.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/acme/jws.go b/acme/jws.go index 1b4d29d5..3b77cd49 100644 --- a/acme/jws.go +++ b/acme/jws.go @@ -41,7 +41,10 @@ func (j *jws) post(url string, content []byte) (*http.Response, error) { } resp, err := httpPost(url, "application/jose+json", bytes.NewBuffer([]byte(signedContent.FullSerialize()))) - + if err != nil { + return nil, fmt.Errorf("Failed to HTTP POST to %s -> %s", url, err.Error()) + } + // Even in case of an error, the response should still contain a nonce. nonce, nonceErr := getNonceFromResponse(resp) if nonceErr == nil {