Javadoc: HttpResponse bodyAs methods return null if body codec is not "Buffer"
Fixes
*/
package io.vertx.ext.web.client;
-import java.util.List;
-
import io.vertx.codegen.annotations.CacheReturn;
import io.vertx.codegen.annotations.Nullable;
import io.vertx.codegen.annotations.VertxGen;
@@ -25,8 +23,11 @@ import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpVersion;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.codec.BodyCodec;
import io.vertx.ext.web.codec.impl.BodyCodecImpl;
+import java.util.List;
+
/**
* An HTTP response.
* <p>
@@ -109,14 +110,14 @@ public interface HttpResponse<T> {
T body();
/**
- * @return the response body decoded as a {@link Buffer}
+ * @return the response body decoded as a {@link Buffer}, or null if a codec other than {@link BodyCodec#buffer()} was used
*/
@CacheReturn
@Nullable
Buffer bodyAsBuffer();
/**
- * @return the response body decoded as a {@code String}
+ * @return the response body decoded as a {@code String}, or null if a codec other than {@link BodyCodec#buffer()} was used
*/
@CacheReturn
@Nullable
@@ -126,7 +127,7 @@ public interface HttpResponse<T> {
}
/**
- * @return the response body decoded as a {@code String} given a specific {@code encoding}
+ * @return the response body decoded as a {@code String} given a specific {@code encoding}, or null if a codec other than {@link BodyCodec#buffer()} was used
*/
@Nullable
default String bodyAsString(String encoding) {
@@ -135,7 +136,7 @@ public interface HttpResponse<T> {
}
/**
- * @return the response body decoded as a json object
+ * @return the response body decoded as {@link JsonObject}, or null if a codec other than {@link BodyCodec#buffer()} was used
*/
@CacheReturn
@Nullable
@@ -145,14 +146,14 @@ public interface HttpResponse<T> {
}
/**
- * @return the response body decoded as a json array
+ * @return the response body decoded as a {@link JsonArray}, or null if a codec other than {@link BodyCodec#buffer()} was used
*/
@CacheReturn
@Nullable
JsonArray bodyAsJsonArray();
/**
- * @return the response body decoded as the specified {@code type} with the Jackson mapper.
+ * @return the response body decoded as the specified {@code type} with the Jackson mapper, or null if a codec other than {@link BodyCodec#buffer()} was used
*/
@Nullable
default <R> R bodyAsJson(Class<R> type) {
