You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Return true if the response's body has been computed by an AsyncHandler. It will return false if the either AsyncHandler.onStatusReceived(HttpResponseStatus) or AsyncHandler.onHeadersReceived(HttpHeaders) returned AsyncHandler.State.ABORT
which I understand as true always if the AsyncHandler did not return ABORT from the onStatusReceived or onHeadersReceived (even if the body itself is empty, in such case I would expect to get empty byte array as the accumulated body).
And yet, if one uses the default AsyncCompletionHandler, which always returns CONTINUE from those two methods, if one gets a response with empty body (Content-Length: 0), then hasResponseBody() on the response returns false.
That is the case, because the NettyResponse, which is created by the AsyncCompletionHandler, implements it as:
I agree that the actual behavior doesn't match the javadoc.
IMHO, the current javadoc has nothing to do with the current method name hasResponseBody. Such method should be named something like isAborted and sadly it's complicated to fix it until next major release.
So I'd rather fix the javadoc to mach current behavior.
The
Response
interface’shasResponseBody
documentation claims:which I understand as
true
always if theAsyncHandler
did not returnABORT
from theonStatusReceived
oronHeadersReceived
(even if the body itself is empty, in such case I would expect to get empty byte array as the accumulated body).And yet, if one uses the default
AsyncCompletionHandler
, which always returnsCONTINUE
from those two methods, if one gets a response with empty body (Content-Length: 0
), thenhasResponseBody()
on the response returnsfalse
.That is the case, because the
NettyResponse
, which is created by theAsyncCompletionHandler
, implements it as:I find this confusing, and believe this might be a bug.
The text was updated successfully, but these errors were encountered: