# Postman Mock Servers --\> Modifying response before returning it to caller

**URL:** <https://community.postman.com/t/postman-mock-servers-modifying-response-before-returning-it-to-caller/43016>\
**Category:** Help Hub\
**Created:** [January 18, 2023, 6:54pm UTC](https://community.postman.com/t/postman-mock-servers-modifying-response-before-returning-it-to-caller/43016 "2023-01-18T18:54:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![docking-module-mete7](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@docking-module-mete7](https://community.postman.com/u/docking-module-mete7)\
**Post date:** [January 18, 2023, 6:54pm UTC](https://community.postman.com/t/postman-mock-servers-modifying-response-before-returning-it-to-caller/43016/1 "2023-01-18T18:54:45Z")

</div>

> **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](https://learning.postman.com/docs/design-apis/mock-apis/mocks/overview) and [Create a mock](https://learning.postman.com/docs/design-apis/mock-apis/mocks/create-a-mock).  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) can build and run mocks for you.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

Is it possible to configure a request in Postman so that we can **modify** the response and _then_ return it back to the caller? I tried searching for results. The closest I got was using Test scripts, but this does not help because it only allows you to modify the “saved” response (which is already sent to the caller). The flow that I am looking for is:

Caller makes request → Postman endpoint hit → Match Response → **modify response** → Send response back to caller.

Example use case: I have a POST request set up for a mock server. The response body (example) saved for this request is “decrypted”. I am wondering if there is a way to configure this request such that when someone calls the mock endpoint, Postman grabs the saved (_decrypted_) response body, then runs some commands to encrypt the data and _then_ send it back to the caller.

The above cannot be done using the Test Scripts feature.
