Class HttpResponse<T>

java.lang.Object
com.google.genai.gaos.utils.transport.HttpResponse<T>

public final class HttpResponse<T> extends Object
An HTTP response that is independent of the underlying HTTP client.

The response body is an InputStream; callers are responsible for consuming and closing it.

  • Constructor Details

    • HttpResponse

      public HttpResponse(HttpRequest request, int statusCode, Headers headers, T body)
  • Method Details

    • request

      public HttpRequest request()
      Returns the request that produced this response.
    • statusCode

      public int statusCode()
    • headers

      public Headers headers()
      Returns a copy of the response headers. Header names are case-insensitive. Mutating the returned Headers does not affect this response.
    • contentType

      public Optional<String> contentType()
      Returns the value of the Content-Type header, if present.
    • body

      public T body()
      Returns the response body. Every call returns the same body instance; for one-shot bodies (streams) the caller is responsible for consuming it at most once and closing it where applicable.
    • toString

      public String toString()
      Overrides:
      toString in class Object