Skip to content

Tutorial section for Mock Servers docs - #181

Open
ganesh-bruno wants to merge 2 commits into
mainfrom
tutor/mock-server
Open

Tutorial section for Mock Servers docs #181
ganesh-bruno wants to merge 2 commits into
mainfrom
tutor/mock-server

Conversation

@ganesh-bruno

Copy link
Copy Markdown
Collaborator
  • Update bru.disableParsingResponseJson() method with req.disableParsingResponseJson() with example
  • Create Tutorial section under mock servers with (collection and openAPI) as separate document

@mintlify

mintlify Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
bruno-docs-main 🟢 Ready View Preview Aug 25, 2026, 7:03 AM

@anthonyd-bruno anthonyd-bruno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should call Mock Tutorial -> Getting Started
Mock with Response Examples -> Mock Servers from Collection
Mock with OpenAPI -> Mock Servers from OpenAPI

description: "Walk through saving collection response examples, creating a mock server from them, syncing, adding rules, and serving the mock locally."
---

Saved [response examples](/send-requests/res-data-cookies/response-examples) are snapshots of how an API behaves: success payloads, validation errors, empty lists, and other states you care about. Once they live on a request, you can document those cases, share them with the team, and with Mock Servers, serve them on `localhost` so a frontend or integration test does not need the real backend.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Saved [response examples](/send-requests/res-data-cookies/response-examples) are snapshots of how an API behaves: success payloads, validation errors, empty lists, and other states you care about. Once they live on a request, you can document those cases, share them with the team, and with Mock Servers, serve them on `localhost` so a frontend or integration test does not need the real backend.
[Response examples](/send-requests/res-data-cookies/response-examples) are snapshots of how an API behaves with success payloads, validation errors, empty lists, and other states you care about. Once they've been saved as an example, you can document those cases, share them with the team, and with Mock Servers, serve them locally so a frontend or integration test can immediately hit the endpoints without needing the real backend to be up and available.

Saved [response examples](/send-requests/res-data-cookies/response-examples) are snapshots of how an API behaves: success payloads, validation errors, empty lists, and other states you care about. Once they live on a request, you can document those cases, share them with the team, and with Mock Servers, serve them on `localhost` so a frontend or integration test does not need the real backend.

<Warning>
Mock Servers are in **Beta**. Open **Preferences → Beta** and turn on **Mock Server**. The **Mock Servers** section appears in the sidebar only after you opt in.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Mock Servers are in **Beta**. Open **Preferences → Beta** and turn on **Mock Server**. The **Mock Servers** section appears in the sidebar only after you opt in.
Mock Servers are in **Beta**. Open **Preferences → Beta** to turn on the **Mock Server** feature. The **Mock Servers** section appears in the sidebar only after you opt in.

Mock Servers are in **Beta**. Open **Preferences → Beta** and turn on **Mock Server**. The **Mock Servers** section appears in the sidebar only after you opt in.
</Warning>

## Create response examples

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows how to create a response example "from scratch". We should also show how to save a response as an example.

Create at least one example per route you plan to mock. Multiple examples on the same method and path become alternative mock responses once you add [rules](/mock-servers/run-mock-server#rules).
</Tip>

## Create a mock from collection examples

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like sequential steps, so we should label them as such.

  1. Create or save response examples
  2. Create a Mock Server tied to a Collection
  3. Sync with examples
    ...


![Create Mock Server dialog with Collection as the source](/images/screenshots/v4/mock-severs/tutorial-create-mock-server.webp)

Bruno opens the mock [dashboard](/mock-servers/run-mock-server#dashboard-interface-walkthrough). The server is not running yet — you still need to sync examples, then start it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really good landmark guide. Nice!

| Match | Behavior |
|-------|----------|
| **All rules AND** (default) | Every condition must pass. |
| **Any rule OR** | One passing condition is enough. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Any rule OR** | One passing condition is enough. |
| **Any rule (OR)** | One passing condition is enough. |


![Rules editor with Save, Try, and Try Result](/images/screenshots/v4/mock-severs/tutorial-collection-examples-rules.webp)

With the mock server running, click **Try** next to the response URL to send the demo request. Open the **Try Result** tab on the right: it shows only the body and headers you defined in **Expected** and **Headers**. Anything not set there will not appear in Try Result.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move the start server stuff to just above here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing for me, I would consider rephrasing.

"Open the Try Result tab on the right: it shows only the body and headers you defined in Expected and Headers. Anything not set there will not appear in Try Result."


With the mock server running, click **Try** next to the response URL to send the demo request. Open the **Try Result** tab on the right: it shows only the body and headers you defined in **Expected** and **Headers**. Anything not set there will not appear in Try Result.

**Demo Request** is generated from the rules you defined. It shows a sample request that would select this response, so you can copy it into a client or use **Try** while the server is running.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Demo Request** is generated from the rules you defined. It shows a sample request that would select this response, so you can copy it into a client or use **Try** while the server is running.
**Demo Request** is generated from the rules you defined. It shows a sample request that would select this response.

The ending was a little confusing for me.


### Right section: expected body and headers

Use this side to define **what** the mock returns: the **Expected** body and **Headers**, plus the status code.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use this side to define **what** the mock returns: the **Expected** body and **Headers**, plus the status code.
Use this side to see **what** the mock returns: the **Expected** body and **Headers**, plus the status code.


The body can be JSON, HTML, text, or XML. Headers are independent of body type, set `Content-Type` and any other headers the client should see.

**Try Result** shows the response body and headers from **Expected** and **Headers** after you click **Try**. Only those values appear — the tab does not invent extra fields.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Try Result** shows the response body and headers from **Expected** and **Headers** after you click **Try**. Only those values appear — the tab does not invent extra fields.
**Try Result** shows the response body and headers from **Expected** and **Headers** after you click **Try** (with the server running).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants