Class WasmRequest

java.lang.Object
org.mockserver.wasm.WasmRequest

public class WasmRequest extends Object
Immutable view of the parts of an HTTP request that a WASM matcher module can inspect: the method, path, headers, and body.

This is the input to the richer WASM ABI. Modules that export match_request(i32 ptr, i32 len) receive a JSON envelope built from this object; modules that export only the legacy match(i32 ptr, i32 len) receive just the body bytes (back-compat).

  • Constructor Details

  • Method Details

    • ofBody

      public static WasmRequest ofBody(String body)
      Convenience factory for a body-only request (legacy behaviour). The method and path are empty and there are no headers.
    • getMethod

      public String getMethod()
    • getPath

      public String getPath()
    • getHeaders

      public Map<String,List<String>> getHeaders()
    • getFirstHeader

      public String getFirstHeader(String name)
      First value of the named header (case-insensitive), or null if absent.
    • getBody

      public String getBody()
    • withHeader

      public WasmRequest withHeader(String name, String value)
      Adds a header value, preserving insertion order and allowing multiple values per name. Returns this for chaining.