diff --git a/retrofit/src/main/java/retrofit2/Response.java b/retrofit/src/main/java/retrofit2/Response.java index 3a6d570091..d07c965440 100644 --- a/retrofit/src/main/java/retrofit2/Response.java +++ b/retrofit/src/main/java/retrofit2/Response.java @@ -147,12 +147,22 @@ public boolean isSuccessful() { return rawResponse.isSuccessful(); } - /** The deserialized response body of a {@linkplain #isSuccessful() successful} response. */ + /** + * The deserialized response body of a {@linkplain #isSuccessful() successful} response. + * + *

If the body is of type {@link ResponseBody}, {@link ResponseBody#close()} must always be + * called to avoid leaking resources + */ public @Nullable T body() { return body; } - /** The raw response body of an {@linkplain #isSuccessful() unsuccessful} response. */ + /** + * The raw response body of an {@linkplain #isSuccessful() unsuccessful} response. + * + *

Calling {@link ResponseBody#close close} on the response body is unnecessary since it is + * closed internally by Retrofit. + */ public @Nullable ResponseBody errorBody() { return errorBody; }