---
title: "evaluate a WebAssembly custom rule against a sample request"
method: POST
path: "/mockserver/wasm/test"
tags: ["wasm"]
---

# evaluate a WebAssembly custom rule against a sample request

`POST /mockserver/wasm/test`

## Request

- Base URL: `http://localhost:1080`
- URL: `http://localhost:1080/mockserver/wasm/test`
- Auth: none declared

Runs a WebAssembly custom rule module against a sample request and reports whether it matched, without registering an expectation. Supply the module either inline as base64 ("module") or by the name of an already-loaded module ("moduleName"); when both are present "module" wins. When a "response" object is also supplied the ABI v3 `shape_response` hook runs and the shaped response is returned alongside the match result.

## Request body

- object
  - `module` string, byte: base64-encoded compiled WebAssembly module bytes
  - `moduleName` string: name of an already-loaded WASM module to evaluate instead of an inline module
  - `request` object: the sample request the rule is evaluated against
    - `method` string
    - `path` string
    - `headers` object
    - `queryStringParameters` object
    - `cookies` object
    - `body` string
  - `response` object: optional sample response; when present the ABI v3 shape_response hook runs and the shaped response is returned with the match result

## Response `200`

module evaluated

- object
  - `matched` boolean

## Other responses

- `400`: missing body, no module source supplied, or 'module' was not valid base64
- `403`: WASM support is disabled (enable with wasmEnabled=true)
- `404`: no WASM module is loaded under the supplied 'moduleName'

---

[API](https://skmtc.dev/mock-server/apis/mockserver-api.md) · [All operations](https://skmtc.dev/mock-server/apis/mockserver-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mock-server/apis/mockserver-api/revisions/9239b693996e?raw)
