Postman Mock Servers (Request Forwarding)

Archived topic — some details may be out of date.
Mock servers built from saved collection examples are still supported. Postman now also has code-based mocks: JavaScript request handlers plus a config.yaml, stored as files in your Git repository, which you can run locally or deploy. Create one in the app, or use the Postman CLI to generate one from an OpenAPI spec, collection or dataset (postman mock generate) and run it (postman mock run). See About mocks and Create a mock.
Working with an AI coding agent? The Postman plugin can build and run mocks for you.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.

I’ve just started using Mock servers with Postman. I was wondering if they also support request forwarding or do we just have “standard” request + response set up only?

I couldn’t find any information regarding request forwarding in the documentation for mock servers or by searching about it online.

Hi @docking-module-mete7 :wave:
If it’s about handling responses based on requests, you can use x-mock-response-name, I’ll leave a part of the documentation that talks a little more about it:

I hope it helped you :slightly_smiling_face:

@cmnazario Hi Cris, thank you for responding! Unfortunately, that’s not quite what I am looking for. I wanted to know if it is possible to configure the Mock server so that we have the option to forward the request to another server (potentially a mocked one) and then return the response back. So, if there was a way to configure one of the requests to be forwarded rather than return the saved example body, that would be awesome.

@docking-module-mete7 hi you could add a pre-request to check if the request is ‘something’ and change pm.request.url to be someother mock url instead of the one you using