ijpiantanida / talkback

A simple HTTP proxy that records and playbacks requests
MIT License
284 stars 41 forks source link

Modify saved response during replay #10

Closed siderakis closed 6 years ago

siderakis commented 6 years ago

My app sets a non-deterministic request id which the response has to match so I need to update the tape to include the request id.

Can we add a new option that allows the outbound tape response to be edited bodyUpdater.

const opts = {
  host: "http://localhost:9001",
  port: 9000,
  bodyMatcher: (tape, req) => {  /** stripe out request id */},
  bodyUpdater: (tape, req) => { /** get new request id from req and replace old request id instances from the tape */}
}
ijpiantanida commented 6 years ago

@siderakis I just release v1.6.0 which includes a responseDecorator option which is very similar to your bodyUpdater proposal.

Thank for the suggestion.