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
public static final class Hook.IdempotencyHook extends java.lang.Object implements Hook.BeforeRequest
-
-
Field Summary
-
Fields inherited from interface com.styra.opa.openapi.utils.Hook.BeforeRequest
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description IdempotencyHook()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.http.HttpRequest
beforeRequest(Hook.BeforeRequestContext context, java.net.http.HttpRequest request)
Transforms the givenHttpRequest
before sending.
-
-
-
Method Detail
-
beforeRequest
public java.net.http.HttpRequest beforeRequest(Hook.BeforeRequestContext context, java.net.http.HttpRequest request) throws java.lang.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
with JDK 16 and later (which will copy the request for modification in a builder). If that method is not available then use) Helpers.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:
java.lang.Exception
- on error
-
-