Package org.mockserver.model
Class HttpResponseModifierCondition
java.lang.Object
org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
org.mockserver.model.ObjectWithJsonToString
org.mockserver.model.HttpResponseModifierCondition
A minimal, self-contained predicate that gates whether a
HttpResponseModifier applies.
The condition is evaluated against the in-flight (upstream) response and, optionally, the original request. It is intentionally small — it reuses the well-known status-code-range string forms rather than inventing a new condition language:
- statusCode — exact equality against the response status code.
- statusCodeRange — an HTTP status class such as
"2xx"/"5XX"(case-insensitive), matched when the status falls in[N00, N99]. - responseHasHeader — the response carries a header with this name (case-insensitive), any value.
- requestHasHeader — the request carries a header with this name (case-insensitive), any value. Ignored when no request is available at the application site.
All configured criteria must hold (logical AND). A condition with no criteria configured
matches everything. An unparseable statusCodeRange is a clean non-match (never throws).
- Author:
- jamesdbloom
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanmatches(HttpResponse response, HttpRequest request) withRequestHasHeader(String requestHasHeader) withResponseHasHeader(String responseHasHeader) withStatusCode(Integer statusCode) withStatusCodeRange(String statusCodeRange) Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
Constructor Details
-
HttpResponseModifierCondition
public HttpResponseModifierCondition()
-
-
Method Details
-
responseModifierCondition
-
getStatusCode
-
withStatusCode
-
getStatusCodeRange
-
withStatusCodeRange
-
getResponseHasHeader
-
withResponseHasHeader
-
getRequestHasHeader
-
withRequestHasHeader
-
matches
- Returns:
truewhen every configured criterion holds for the given response/request.
-
equals
- Overrides:
equalsin classObjectWithReflectiveEqualsHashCodeToString
-
hashCode
public int hashCode()- Overrides:
hashCodein classObjectWithReflectiveEqualsHashCodeToString
-