File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
scribejava-core/src/main/java/com/github/scribejava/core/model Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 55import java .util .Map ;
66import com .github .scribejava .core .utils .StreamUtils ;
77
8+ /**
9+ * An HTTP response.
10+ *
11+ * <p>This response may contain a non-null body stream of the HttpUrlConnection. If so, this body must be closed to
12+ * avoid leaking resources. Use either {@code getBody()} or {@code getStream().close()} to close the body.
13+ */
814public class Response {
915
1016 private final int code ;
@@ -45,6 +51,9 @@ public boolean isSuccessful() {
4551 return code >= 200 && code < 400 ;
4652 }
4753
54+ /**
55+ * Returns the response body as a string, closing the stream that backs it. Idempotent.
56+ */
4857 public String getBody () throws IOException {
4958 return body == null ? parseBodyContents () : body ;
5059 }
You can’t perform that action at this time.
0 commit comments