mountebank icon indicating copy to clipboard operation
mountebank copied to clipboard

Allow behaviors to transform saved proxy responses

Open bbyars opened this issue 8 years ago • 2 comments

Currently behaviors allow the proxy response to be transformed, and in the case of wait and decorate, allow you to add behaviors to to saved responses. There may be times when you need to change the is response captured by proxying before saving it: for example, to remove PII for test data.

Not yet sure what the interface should be, perhaps something on the proxy config that indicates which behaviors apply before saving and which after.

bbyars avatar Aug 01 '17 17:08 bbyars

Maybe something like this:

"stubs": [{
  "responses": [{
    "proxy": {
      "to": "http://origin-server.com",
      "addWaitBehavior": true,
       "proxyBehaviors": {
         "decorate": "..."
       }
    },
    "_behaviors": {
        "repeat": 2
    }
  }]
}]

In that example, the repeat behavior would apply to the proxy response (not the saved response), which is current behavior. The proxyBehaviors would transform the saved response, and would include all behaviors except wait and repeat.

bbyars avatar Jun 25 '19 01:06 bbyars