Package com.styra.opa.openapi.utils
Class Helpers
- java.lang.Object
-
- com.styra.opa.openapi.utils.Helpers
-
public final class Helpers extends java.lang.Object
Public helper methods for use by customers and end-users.
-
-
Constructor Summary
Constructors Constructor Description Helpers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.http.HttpRequest.Builder
copy(java.net.http.HttpRequest request)
Returns anHttpRequest.Builder
which is initialized with the state of the givenHttpRequest
.static java.net.http.HttpRequest.Builder
copy(java.net.http.HttpRequest request, java.util.function.BiPredicate<java.lang.String,java.lang.String> filter)
Returns anHttpRequest.Builder
which is initialized with the state of the givenHttpRequest
.
-
-
-
Method Detail
-
copy
public static java.net.http.HttpRequest.Builder copy(java.net.http.HttpRequest request)
Returns anHttpRequest.Builder
which is initialized with the state of the givenHttpRequest
.Note that headers can be added and modified but not removed. To remove headers use
copy(HttpRequest, BiPredicate)
(which applies a filter to the headers while copying).Note also that this method is redundant from JDK 16 because the method
HttpRequest.newBuilder(HttpRequest)
is available.- Parameters:
request
- request to copy- Returns:
- a builder initialized with values from
request
-
copy
public static java.net.http.HttpRequest.Builder copy(java.net.http.HttpRequest request, java.util.function.BiPredicate<java.lang.String,java.lang.String> filter)
Returns anHttpRequest.Builder
which is initialized with the state of the givenHttpRequest
.Note that this method is redundant from JDK 16 because the method
HttpRequest.newBuilder(HttpRequest, BiPredicate)
is available.- Parameters:
request
- request to copyfilter
- selects which header key-values to include in the copied request- Returns:
- a builder initialized with values from
request
-
-