Package de.gematik.test.tiger.lib
Class TigerHttpClient
java.lang.Object
de.gematik.test.tiger.lib.TigerHttpClient
This class provides methods to send requests with RestAssured. It also provides methods to
resolve placeholders in the request body and send the resolved body.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyRedirectConfig(io.restassured.config.RedirectConfig newRedirectConfig) Apply a new RedirectConfig to the RestAssured configuration.static voidexecuteCommandInBackground(org.assertj.core.api.SoftAssertionsProvider.ThrowingRunnable command) Execute a command in the background.static voidexecuteCommandWithContingentWait(org.assertj.core.api.SoftAssertionsProvider.ThrowingRunnable command) Execute a command with a contingent wait.static io.restassured.specification.RequestSpecificationCreate a configurable RequestSpecification with default Tiger headers.static voidreset()static voidReset the RedirectConfig to the default configuration.static de.gematik.rbellogger.writer.RbelSerializationResultResolve placeholders in the given value and return the result as a byte array.static StringresolveToString(String value) Resolve placeholders in the given value and return the result as a string.static voidsendResolvedBody(io.restassured.http.Method method, URI address, String body) Send a request with the given method, address and body.static voidsendResolvedBody(io.restassured.http.Method method, URI address, String contentType, String body) Send a request with the given method, address and body.
-
Field Details
-
KEY_HTTP_CLIENT
- See Also:
-
KEY_TIGER
- See Also:
-
KEY_DEFAULT_HEADER
- See Also:
-
-
Method Details
-
reset
public static void reset() -
givenDefaultSpec
public static io.restassured.specification.RequestSpecification givenDefaultSpec()Create a configurable RequestSpecification with default Tiger headers. Example:givenDefaultSpec() .formParams(resolveMap(dataAsMaps.get(0), true)) .headers(Map.of("header", "value")) .contentType(ContentType.JSON) .request(method, address));- Returns:
- configurable RequestSpecification
-
executeCommandInBackground
public static void executeCommandInBackground(org.assertj.core.api.SoftAssertionsProvider.ThrowingRunnable command) Execute a command in the background. This is useful for long-running tasks that should not block the main thread.- Parameters:
command- the command to execute
-
executeCommandWithContingentWait
public static void executeCommandWithContingentWait(org.assertj.core.api.SoftAssertionsProvider.ThrowingRunnable command) Execute a command with a contingent wait. If the configuration value `executeBlocking` is set to `true`, the command is executed immediately. Otherwise, the command is executed in the background.- Parameters:
command- the command to execute
-
applyRedirectConfig
public static void applyRedirectConfig(io.restassured.config.RedirectConfig newRedirectConfig) Apply a new RedirectConfig to the RestAssured configuration.- Parameters:
newRedirectConfig- the new RedirectConfig to apply
-
resetRedirectConfig
public static void resetRedirectConfig()Reset the RedirectConfig to the default configuration. -
resolveToString
Resolve placeholders in the given value and return the result as a string.- Parameters:
value- the value to resolve- Returns:
- the value, but resolved
-
resolve
Resolve placeholders in the given value and return the result as a byte array.- Parameters:
value- the value to resolve- Returns:
- the value, but resolved as a byte array
-
sendResolvedBody
Send a request with the given method, address and body. The body is resolved before sending.- Parameters:
method- the HTTP method to useaddress- the URI to send the request tobody- the body (which is to be resolved) of the request
-
sendResolvedBody
public static void sendResolvedBody(io.restassured.http.Method method, URI address, String contentType, String body) Send a request with the given method, address and body. The body is resolved before sending.- Parameters:
method- the HTTP method to useaddress- the URI to send the request tocontentType- the content type of the requestbody- the body (which is to be resolved) of the request
-