Class SpeakeasyHTTPClient
- java.lang.Object
-
- com.stackone.stackone_client_java.utils.SpeakeasyHTTPClient
-
- All Implemented Interfaces:
HTTPClient
public class SpeakeasyHTTPClient extends java.lang.Object implements HTTPClient
-
-
Constructor Summary
Constructors Constructor Description SpeakeasyHTTPClient()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.http.HttpResponse<java.io.InputStream>send(java.net.http.HttpRequest request)Sends an HTTP request and returns the response.static voidsetDebugLogging(boolean enabled)Experimental, may be changed anytime.static voidsetLogger(java.util.function.Consumer<? super java.lang.String> logger)static voidsetRedactedHeaders(java.util.Collection<java.lang.String> headerNames)Experimental, may be changed anytime.
-
-
-
Method Detail
-
setDebugLogging
public static void setDebugLogging(boolean enabled)
Experimental, may be changed anytime. Sets debug logging on or off for requests and responses including bodies for JSON content. WARNING: this setting may expose sensitive information in logs (like Authorization headers), and should only be enabled temporarily for local debugging purposes. By default, Authorization headers are redacted in the logs ( printed with a value of[*******]). Header suppression is controlled with thesetRedactedHeaders(Collection)method.- Parameters:
enabled- true to enable debug logging, false to disable it
-
setRedactedHeaders
public static void setRedactedHeaders(java.util.Collection<java.lang.String> headerNames)
Experimental, may be changed anytime. When debug logging is enabled this method controls the suppression of header values in the logs. By default, Authorization headers are redacted in the logs (printed with a value of[*******]). Header suppression is controlled with thesetRedactedHeaders(Collection)method.- Parameters:
headerNames- the names (case-insensitive) of the headers whose values will be redacted in the logs
-
setLogger
public static void setLogger(java.util.function.Consumer<? super java.lang.String> logger)
-
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
-
-