Package com.styra.opa.openapi.utils
Class Hook.IdempotencyHook
java.lang.Object
com.styra.opa.openapi.utils.Hook.IdempotencyHook
- All Implemented Interfaces:
Hook.BeforeRequest
- Enclosing class:
- Hook
-
Field Summary
Fields inherited from interface com.styra.opa.openapi.utils.Hook.BeforeRequest
DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbeforeRequest(Hook.BeforeRequestContext context, HttpRequest request) Transforms the givenHttpRequestbefore sending.
-
Constructor Details
-
IdempotencyHook
public IdempotencyHook()
-
-
Method Details
-
beforeRequest
public HttpRequest beforeRequest(Hook.BeforeRequestContext context, HttpRequest request) throws Exception Description copied from interface:Hook.BeforeRequestTransforms the givenHttpRequestbefore sending.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:
beforeRequestin interfaceHook.BeforeRequest- Parameters:
context- context for the hook callrequest- request to be transformed- Returns:
- transformed request
- Throws:
Exception- on error
-