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 givenHttpRequest
before sending.
-
Constructor Details
-
IdempotencyHook
public IdempotencyHook()
-
-
Method Details
-
beforeRequest
public HttpRequest beforeRequest(Hook.BeforeRequestContext context, HttpRequest request) throws Exception Description copied from interface:Hook.BeforeRequest
Transforms the givenHttpRequest
before sending.Note that
HttpRequest
is 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:
beforeRequest
in interfaceHook.BeforeRequest
- Parameters:
context
- context for the hook callrequest
- request to be transformed- Returns:
- transformed request
- Throws:
Exception
- on error
-