Add error checking for the jws httpPost (#360)

https://github.com/xenolf/lego/issues/359
This commit is contained in:
Mahmoud Abdelsalam 2017-03-17 11:58:44 -07:00 committed by xenolf
parent e526fb5a1a
commit 0e2937900b

View file

@ -41,6 +41,9 @@ func (j *jws) post(url string, content []byte) (*http.Response, error) {
} }
resp, err := httpPost(url, "application/jose+json", bytes.NewBuffer([]byte(signedContent.FullSerialize()))) 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. // Even in case of an error, the response should still contain a nonce.
nonce, nonceErr := getNonceFromResponse(resp) nonce, nonceErr := getNonceFromResponse(resp)