Endpoints
An endpoint is a single mock API route within a project. It defines what happens when a request matches a specific method and path.
Endpoint Properties
Section titled “Endpoint Properties”| Property | Description |
|---|---|
| Method | HTTP method to match (GET, POST, PUT, PATCH, DELETE) |
| Path | URL path to match (supports dynamic segments like :id) |
| Status Code | Default HTTP status code to return |
| Response Body | Default response content |
| Content-Type | MIME type of the response |
Mock Rules
Section titled “Mock Rules”Endpoints can have mock rules that override the default response based on request properties. See Mock Rules for details.
Request Matching
Section titled “Request Matching”When a request arrives, mockd matches it against endpoints in order:
- Method must match exactly
- Path is matched segment-by-segment, with
:paramsegments matching any value
If multiple endpoints could match, the most specific path wins (static segments take priority over dynamic ones).