Package com.google.genai.gaos.utils
Class RecordingClient
java.lang.Object
com.google.genai.gaos.utils.RecordingClient
- All Implemented Interfaces:
HTTPClient,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrequests()voidreset()send(HttpRequest request) Sends an HTTP request and returns the response.sendAsync(HttpRequest request) Sends an HTTP request asynchronously and returns a response whose body is exposed as anInputStream(the same body type as the synchronousHTTPClient.send(HttpRequest)).Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.genai.gaos.utils.HTTPClient
close, enableDebugLogging, isDebugLoggingEnabled
-
Constructor Details
-
RecordingClient
public RecordingClient()
-
-
Method Details
-
send
Description copied from interface:HTTPClientSends an HTTP request and returns the response.Note that
HttpRequestis immutable. To modify the request useHttpRequest.toBuilder()which copies the request into a builder.- Specified by:
sendin interfaceHTTPClient- Parameters:
request- HTTP request- Returns:
- HTTP response
- Throws:
IOException
-
sendAsync
Description copied from interface:HTTPClientSends an HTTP request asynchronously and returns a response whose body is exposed as anInputStream(the same body type as the synchronousHTTPClient.send(HttpRequest)).The request is dispatched without blocking the calling thread. The returned
CompletableFuturecompletes when the response headers are received — the body is not read at that point — or completes exceptionally if an error occurs during the request or response processing.- Specified by:
sendAsyncin interfaceHTTPClient- Parameters:
request- the HTTP request to send- Returns:
- a
CompletableFuturecontaining the HTTP response with anInputStreambody
-
requests
-
beforeRequest
-
afterResponse
-
reset
public void reset()
-