Interface HttpClient
HttpClient provides a fluent API for building and executing HTTP requests with various HTTP methods. It supports request customization including headers, authentication, request bodies, timeouts, and retries.
Basic Usage: Use the HTTP method factories (GET(java.lang.String)
, POST(java.lang.String)
,
etc.) to start building requests, then chain configuration methods and finally call
invoke()
to execute.
Request Building: The returned RequestBuilder
allows configuring
headers, request bodies, authentication, timeouts, retries, and response parsing before
execution.
Response Handling: By default, responses are returned as ByteString
.
Use responseBodyAs(Class)
to automatically deserialize JSON responses to Java objects.
Error Handling: HTTP error status codes (4xx, 5xx) are included in the response. Use the response's status code to determine success or failure and handle errors appropriately.
Not for user extension, instances provided by HttpClientProvider
and the testkit.
-
Method Summary
Modifier and TypeMethodDescriptionRequestBuilder
<akka.util.ByteString> RequestBuilder
<akka.util.ByteString> RequestBuilder
<akka.util.ByteString> RequestBuilder
<akka.util.ByteString> RequestBuilder
<akka.util.ByteString>
-
Method Details
-
GET
-
POST
-
PUT
-
PATCH
-
DELETE
-