From d1c4199db3996fceddc7eb4262c61daa1331440e Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 29 Jan 2020 19:20:05 -0500 Subject: [PATCH] No need to use the type name of an input arg in the method name. (#208) * No need to use the type name of an input arg in the method name. * Do not use input type names in method names. --- RELEASE_NOTES.txt | 7 +++++++ .../cache/CachedHttpResponseGenerator.java | 2 +- .../AbstractSimpleServerExchangeHandler.java | 2 +- ...AbstractHttpAsyncClientAuthentication.java | 6 +++--- .../async/AbstractHttpAsyncRedirectsTest.java | 12 +++++------ .../async/TestHttp1AsyncRedirects.java | 2 +- .../TestHttp1AsyncStatefulConnManagement.java | 4 ++-- .../http/async/methods/SimpleHttpRequest.java | 16 +++++++++++++++ .../async/methods/SimpleHttpResponse.java | 20 +++++++++++++++++-- .../async/methods/SimpleResponseConsumer.java | 2 +- 10 files changed, 56 insertions(+), 17 deletions(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index ceecf89b9..f4c68ad95 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -15,6 +15,13 @@ SimpleHttpRequests.create(String, String) Contributed by Gary Gregory +* GitHub #208: Do not use input type names in method names: + SimpleHttpRequest: Deprecate setBodyBytes(byte[], ContentType) in favor of setBody(byte[], ContentType) + SimpleHttpRequest: Deprecate setBodyText(String, ContentType) in favor of setBody(String, ContentType) + SimpleHttpResponse: Deprecate setBodyBytes(byte[], ContentType) in favor of setBody(byte[], ContentType) + SimpleHttpResponse: Deprecate setBodyText(String, ContentType) in favor of setBody(String, ContentType) + Contributed by Gary Gregory + Release 5.0-BETA7 ----------------- diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachedHttpResponseGenerator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachedHttpResponseGenerator.java index 614ed0eee..455c0efd5 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachedHttpResponseGenerator.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachedHttpResponseGenerator.java @@ -76,7 +76,7 @@ class CachedHttpResponseGenerator { final ContentType contentType = h != null ? ContentType.parse(h.getValue()) : null; final byte[] content = resource.get(); addMissingContentLengthHeader(response, content); - response.setBodyBytes(content, contentType); + response.setBody(content, contentType); } final TimeValue age = this.validityStrategy.getCurrentAge(entry, now); diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java index 24635acd9..e3e2881fa 100644 --- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java +++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java @@ -65,7 +65,7 @@ public abstract class AbstractSimpleServerExchangeHandler extends AbstractServer final ContentType contentType) { final SimpleHttpRequest simpleRequest = SimpleHttpRequest.copy(request); if (body != null) { - simpleRequest.setBodyBytes(body, contentType); + simpleRequest.setBody(body, contentType); } return simpleRequest; } diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java index 872481bc8..20f6af23d 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java @@ -246,7 +246,7 @@ public abstract class AbstractHttpAsyncClientAuthentication future = httpclient.execute(put, context, null); final HttpResponse response = future.get(); @@ -276,7 +276,7 @@ public abstract class AbstractHttpAsyncClientAuthentication future = httpclient.execute(put, context, null); final HttpResponse response = future.get(); @@ -303,7 +303,7 @@ public abstract class AbstractHttpAsyncClientAuthentication future = httpclient.execute(put, context, null); final HttpResponse response = future.get(); diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java index 1a11fb47a..e92af3a1a 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java @@ -110,7 +110,7 @@ public abstract class AbstractHttpAsyncRedirectsTest future = httpclient.execute(post, context, null); final HttpResponse response = future.get(); Assert.assertNotNull(response); @@ -553,7 +553,7 @@ public abstract class AbstractHttpAsyncRedirectsTest