diff --git a/http-client/src/main/java/io/avaje/http/client/DHttpClientContext.java b/http-client/src/main/java/io/avaje/http/client/DHttpClientContext.java index f7a240be3..ddbff482c 100644 --- a/http-client/src/main/java/io/avaje/http/client/DHttpClientContext.java +++ b/http-client/src/main/java/io/avaje/http/client/DHttpClientContext.java @@ -274,20 +274,24 @@ BodyReader beanReader(Type type) { } T readBean(Class type, BodyContent content) { + if(content.content().length == 0) return null; return bodyAdapter.beanReader(type).read(content); } List readList(Class type, BodyContent content) { + if(content.content().length == 0) return null; return bodyAdapter.listReader(type).read(content); } @SuppressWarnings("unchecked") T readBean(Type type, BodyContent content) { + if(content.content().length == 0) return null; return (T) bodyAdapter.beanReader(type).read(content); } @SuppressWarnings("unchecked") List readList(Type type, BodyContent content) { + if(content.content().length == 0) return null; return (List) bodyAdapter.listReader(type).read(content); }