Package com.styra.opa.openapi.utils
Interface Hook.BeforeRequest
- All Known Implementing Classes:
Hook.IdempotencyHook,Hooks
- Enclosing class:
- Hook
public static interface Hook.BeforeRequest
Specifies how a request is transformed before sending.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Hook.BeforeRequestThe default action is to return the request untouched. -
Method Summary
Modifier and TypeMethodDescriptionbeforeRequest(Hook.BeforeRequestContext context, HttpRequest request) Transforms the givenHttpRequestbefore sending.
-
Field Details
-
DEFAULT
The default action is to return the request untouched.
-
-
Method Details
-
beforeRequest
Transforms 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).- Parameters:
context- context for the hook callrequest- request to be transformed- Returns:
- transformed request
- Throws:
Exception- on error
-