Merge pull request #68 from Alexandr-Dolgov/master

Log HEAD request and its headers
pull/69/head
Richard Körber 2018-08-01 19:11:00 +02:00 committed by GitHub
commit b9f9e96d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -106,11 +106,15 @@ public class DefaultConnection implements Connection {
URL newNonceUrl = session.resourceUrl(Resource.NEW_NONCE);
LOG.debug("HEAD {}", newNonceUrl);
conn = httpConnector.openConnection(newNonceUrl, session.getProxy());
conn.setRequestMethod("HEAD");
conn.setRequestProperty(ACCEPT_LANGUAGE_HEADER, session.getLocale().toLanguageTag());
conn.connect();
logHeaders();
int rc = conn.getResponseCode();
if (rc != HttpURLConnection.HTTP_OK && rc != HttpURLConnection.HTTP_NO_CONTENT) {
throwAcmeException();

View File

@ -188,6 +188,7 @@ public class DefaultConnectionTest {
verify(mockUrlConnection, atLeastOnce()).connect();
verify(mockUrlConnection, atLeastOnce()).getResponseCode();
verify(mockUrlConnection, atLeastOnce()).getHeaderField("Replay-Nonce");
verify(mockUrlConnection, atLeastOnce()).getHeaderFields();
verifyNoMoreInteractions(mockUrlConnection);
}