This is what makes Understudy different from a plain mock. Point your app's HTTP client at the Understudy runtime instead of the real API, and it answers like the real thing, holding state you control.
Real CRUD, real state
- POST creates a record and stores it.
- GET reads it straight back, the same record you just made.
- PUT, PATCH and DELETE update and remove records.
The data lives in storage you choose, and it stays there. POST an order, and it is still there when you GET it a minute later.
What happens on every request
For each call, the runtime:
- Matches the route in your contract. A literal path always wins over a parameterised one.
- Checks the request: the path, query and header parameters, and the body.
- Applies the right CRUD action, worked out from the method and whether the path is a collection or a single item.
- Shapes the response to the schema your contract declares.
- Checks the response before sending it. A response that would break your contract is never returned. It becomes a loud error in your logs instead.
So your app meets the same behaviour it would in production, every time.