Package org.a2aproject.sdk.client.http
Interface A2AHttpResponse
public interface A2AHttpResponse
HTTP response wrapper containing status code and response body.
Provides access to the HTTP status code, a success indicator, and the response body content.
Usage Example
A2AHttpResponse response = client.createGet()
.url("http://localhost:9999/api/endpoint")
.get();
if (response.success()) {
String body = response.body();
// Process successful response
} else {
int status = response.status();
// Handle error based on status code
}
-
Method Summary
-
Method Details
-
status
int status()Returns the HTTP status code.- Returns:
- the HTTP status code (e.g., 200, 404, 500)
-
success
boolean success()Indicates whether the request was successful.Typically returns
truefor 2xx status codes.- Returns:
trueif the request was successful,falseotherwise
-
body
String body()Returns the response body content as a string.- Returns:
- the response body, may be empty but not null
-
headers
Returns the HTTP response headers.Provides access to response headers such as
Retry-After,WWW-Authenticate, or any other server-provided headers.- Returns:
- the response headers, never null; may be empty
-