Class HttpResponseMatcher

java.lang.Object
org.mockserver.matchers.HttpResponseMatcher

public class HttpResponseMatcher extends Object
Matches an actual HttpResponse against a template HttpResponse.

Each template field constrains the match only when it is set (non-null/non-blank). A null or empty template matches any response.

Body matching shares the exact dispatch used by request matching via BodyMatching, so a response body matcher has full parity with a request body matcher: XML/form actual bodies are converted to JSON for the JSON family of matchers, an optional template body matches an absent response body, multipart and binary (including original/compressed) bodies are handled, and an absent actual body against a JSON/XML matcher is a clean non-match rather than a swallowed NPE.

Cookie matching mirrors the request matcher: when the template declares structured cookies they are matched (sub-set semantics, extra response cookies allowed, notted values supported) via the same HashMapMatcher the request side uses.