Package pl.gsmservice.gateway.utils
Class RecordingClient
- java.lang.Object
-
- pl.gsmservice.gateway.utils.RecordingClient
-
- All Implemented Interfaces:
HTTPClient
public final class RecordingClient extends java.lang.Object implements HTTPClient
-
-
Constructor Summary
Constructors Constructor Description RecordingClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecordingClientafterResponse(java.util.function.UnaryOperator<java.net.http.HttpResponse<java.io.InputStream>> hook)RecordingClientbeforeRequest(java.util.function.UnaryOperator<java.net.http.HttpRequest> hook)java.util.List<java.net.http.HttpRequest>requests()voidreset()java.net.http.HttpResponse<java.io.InputStream>send(java.net.http.HttpRequest request)Sends an HTTP request and returns the response.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface pl.gsmservice.gateway.utils.HTTPClient
enableDebugLogging, isDebugLoggingEnabled, sendAsync
-
-
-
-
Method Detail
-
send
public java.net.http.HttpResponse<java.io.InputStream> send(java.net.http.HttpRequest request) throws java.io.IOException, java.lang.InterruptedException, java.net.URISyntaxExceptionDescription copied from interface:HTTPClientSends an HTTP request and returns the response.Note that
HttpRequestis immutable. To modify the request you can useHttpRequest#newBuilder(HttpRequest, BiPredicate<String, String>)with JDK 16 and later (which will copy the request for modification in a builder). If that method is not available then useHelpers.copy(java.net.http.HttpRequest)(which also returns a builder).- Specified by:
sendin interfaceHTTPClient- Parameters:
request- HTTP request- Returns:
- HTTP response
- Throws:
java.io.IOExceptionjava.lang.InterruptedExceptionjava.net.URISyntaxException
-
requests
public java.util.List<java.net.http.HttpRequest> requests()
-
beforeRequest
public RecordingClient beforeRequest(java.util.function.UnaryOperator<java.net.http.HttpRequest> hook)
-
afterResponse
public RecordingClient afterResponse(java.util.function.UnaryOperator<java.net.http.HttpResponse<java.io.InputStream>> hook)
-
reset
public void reset()
-
-