Hexbuffer
API Tools & Security

API Mock Server (New)

Standalone local mock server with templated responses, dynamic route parameters, request matchers, and chaos engineering.

API Mock Server

The API Mock module runs a standalone HTTP mock server on localhost, letting you build and test front-end applications before backend APIs are ready—or simulate unreliable upstreams—without touching live proxy traffic.


Running the Server

  • Local Binding: The server binds to 127.0.0.1 on a configurable port (default 4000).
  • Start/Stop Control: Start and stop the server from the toolbar with a live status indicator showing the running state and URL.
  • Domains: Routes are organized under domains (hostnames), each with an SSL flag so you can simulate HTTPS endpoints.

Route Configuration

Each route defines a full mock response:

  • Method & Path: Choose GET, POST, PUT, DELETE, PATCH, or OPTIONS and define the endpoint path.
  • Status Code: Return any HTTP status (200 OK, 201 Created, 400 Bad Request, 500 Server Error, ...).
  • Response Body & Headers: Configure the JSON/text payload and custom response headers (e.g., Content-Type, rate-limit headers, authentication tokens).

Dynamic Route Parameters

Define parameters in Express (:id) or OpenAPI ({id}) style. Extracted path and query values are substituted into the response body via template variables such as {{param.id}}, {{query.x}}, {{path}}, and {{method}}. A live preview renders the rendered body with sample values as you type, and a JSON body template is auto-generated from detected route parameters.

Request Matchers

Optionally require requests to match specific conditions before the route responds:

  • Header key/value pairs
  • Query parameter key/value pairs
  • Request body content

Chaos Engineering

Simulate degraded and unreliable upstreams per route:

  • Latency Injection: Fixed or randomized (min–max range) artificial delays to test loading states, spinners, and timeout recovery.
  • Error Rate Injection: Configure a percentage chance of returning an error status (default 500) to exercise failure handling.

CORS Support

Enable the CORS toggle on the server to handle OPTIONS preflight requests automatically and emit permissive CORS headers—ideal for testing browser-based front ends during local development.


Request Logging

Every request served is logged per route (method, path, status, latency, headers, body, timestamp) and streamed live into the Logs sub-tab (buffer of 200 entries), so you can verify exactly what your application sent and how the mock responded.

On this page