Class Hook.IdempotencyHook

    • 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 given HttpRequest before sending.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IdempotencyHook

        public IdempotencyHook()
    • 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 given HttpRequest before sending.

        Note that HttpRequest is immutable. To modify the request you can use HttpRequest#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 interface Hook.BeforeRequest
        Parameters:
        context - context for the hook call
        request - request to be transformed
        Returns:
        transformed request
        Throws:
        java.lang.Exception - on error