HTTP with mock://
Goal
Learn what an HTTP block publishes, without needing a network connection or credentials. Time: 5 minutes.
A url beginning with mock:// returns a canned 200 response. It makes no network request. Direct URLs are accepted only for mock://. To call a real API, you use a saved endpoint, which is covered in the next lesson.
What HTTP publishes
| Property | Type | Notes |
|---|---|---|
status | number | Always available. A non-success status fails the block (HTTP 404.) |
body | string | The response body, capped at 4,096 bytes in the record |
| top-level JSON keys | varies | When the response is a JSON object. Declare the ones you need in outputs. The mock body is {"ok":true,"mock":true,"method":"GET","path":"users"} |
Templates work in url too, for example url: "mock://users/{{ loop.index }}".
Check your run
read publishes line: "200 users (…bytes)".
Exercise
Change the method to POST and publish the method property from the mock response.