java.lang.Object
com.hedera.hashgraph.sdk.HttpResponse
One response from an
HttpTransport.
Note that this is the SDK's own transport-layer type, not java.net.http.HttpResponse.
Header names are ASCII-lowercased and values are list-valued, and both are normative. The
same wire header otherwise produces a different key in every runtime — Go canonicalises to
Retry-After, browsers lowercase, and the JDK preserves whatever the server sent behind a
case-insensitive comparator that is lost the moment the map is copied. HTTP/2 lowercases every header
name on the wire while HTTP/1.1 does not, so a helper reading Retry-After would find it
against one mirror node and miss it against another. List-valued because a single-valued map
silently discards all but one value of a repeated header.
-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpResponseCreate a response.byte[]getBody()Extract a copy of the response body.getFirstHeaderValue(String name) Extract the first value of a header.Extract the response headers, with lowercased names.intExtract the HTTP status code.toString()
-
Method Details
-
create
Create a response.- Parameters:
statusCode- the HTTP status codebody- the response body; defensively copiedheaders- the response headers; names are lowercased and values copied- Returns:
- the new response
-
getStatusCode
public int getStatusCode()Extract the HTTP status code.- Returns:
- the status code
-
getBody
public byte[] getBody()Extract a copy of the response body.- Returns:
- the body
-
getHeaders
Extract the response headers, with lowercased names.- Returns:
- an unmodifiable map, never null
-
getFirstHeaderValue
Extract the first value of a header.- Parameters:
name- the header name, matched after lowercasing- Returns:
- the first value, or empty when the header is absent
-
toString
-