Package com.petarmc.lib.net
Class HttpResponse
java.lang.Object
com.petarmc.lib.net.HttpResponse
Represents an HTTP response with status code, body, and headers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
statusCode
public final int statusCodeThe HTTP status code of the response. -
body
The body of the response as a string. -
headers
The HTTP headers of the response.
-
-
Constructor Details
-
HttpResponse
Constructs a new HttpResponse.- Parameters:
statusCode- the HTTP status codebody- the response body, or empty string if nullheaders- the response headers, or empty if null
-
-
Method Details
-
isSuccess
public boolean isSuccess()Returns true if the status code indicates a successful response (200-299).- Returns:
- true if status code is 200–299, false otherwise
-
toString
Returns a string representation of the HttpResponse, including status code and body length.
-