Class WasmResponse

java.lang.Object
org.mockserver.wasm.WasmResponse

public class WasmResponse extends Object
Immutable view of the parts of an HTTP response that a WASM shape_response module can read and rewrite: the statusCode, headers, and body.

This is the response half of the WASM host ABI v3 (response shaping). It is used in two directions:

  • as input — the response the matched expectation would return, serialised into the shape envelope so the module can inspect it; and
  • as output — the (possibly partial) response the module returns, parsed back out of the module's JSON.

Null semantics for the parsed output. A null field means "absent — leave the materialised response unchanged": a null statusCode leaves the status untouched, a null/empty headers map adds/overwrites nothing, and a null body leaves the body unchanged. Present values replace (status and body) or merge (headers) into the response. See WasmResponseShaper for how the parsed output is applied.

  • Constructor Details

    • WasmResponse

      public WasmResponse(Integer statusCode, Map<String,List<String>> headers, String body)
      Parameters:
      statusCode - the HTTP status code, or null when absent/unchanged
      headers - header name to list of values, or null when absent (never mutated here)
      body - the response body string, or null when absent/unchanged
  • Method Details