public class HttpClient extends Object
| Constructor and Description |
|---|
HttpClient(Auth auth)
Create an HttpClient with default configuration.
|
HttpClient(Auth auth,
HttpConfig config)
Create an HttpClient with custom configuration.
|
HttpClient(Auth auth,
HttpConfig config,
io.opentelemetry.context.propagation.ContextPropagators propagators)
Create an HttpClient with custom configuration and trace propagators.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the HTTP client and release resources.
|
String |
get(String url)
Execute a GET request.
|
String |
post(String url,
Object body)
Execute a POST request with JSON body.
|
String |
post(String url,
Object body,
Map<String,String> headers)
Execute a POST request with JSON body and custom headers.
|
String |
postMultipart(String url,
okhttp3.MultipartBody formData)
Execute a POST request with multipart form data.
|
okhttp3.Response |
postStream(String url,
Object body)
Execute a POST request with JSON body and return Response for streaming.
|
public HttpClient(Auth auth)
auth - the authentication providerpublic HttpClient(Auth auth, HttpConfig config)
auth - the authentication providerconfig - the HTTP configurationpublic HttpClient(Auth auth, HttpConfig config, io.opentelemetry.context.propagation.ContextPropagators propagators)
auth - the authentication providerconfig - the HTTP configurationpropagators - the trace context propagatorspublic String get(String url)
url - the URLpublic String post(String url, Object body)
url - the URLbody - the request body objectpublic String post(String url, Object body, Map<String,String> headers)
url - the URLbody - the request body objectheaders - custom headerspublic String postMultipart(String url, okhttp3.MultipartBody formData)
url - the URLformData - the multipart form datapublic okhttp3.Response postStream(String url, Object body) throws IOException
url - the URLbody - the request body objectIOException - if the request failspublic void close()
Copyright © 2026. All rights reserved.